All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extredisson.common.ProjectRedisKeyGenerator Maven / Gradle / Ivy

The newest version!
package com.github.lontime.extredisson.common;

import com.github.lontime.extredisson.configuration.OptionResolver;

/**
 * @author apple
 */
public class ProjectRedisKeyGenerator {

    public static RedisKeys root() {
        return OptionResolver.getInstance().getProjectName();
    }

    public static RedisKeys serviceReply(String name, String to) {
        return RedisKeys.create(root(), "service", name, "reply", to);
    }

    public static RedisKeys refOfService(String name) {
        return refOfService(name, null);
    }

    public static RedisKeys refOfService(String name, String tag) {
        return RedisKeys.create(root(), "service", "ref", name, tag);
    }

    public static RedisKeys topicOfStream(String name) {
        return topic("topic", name);
    }

    public static RedisKeys topicOfService(String name) {
        return topic("service", name);
    }

    public static RedisKeys topic(String namespace, String name) {
        return RedisKeys.create(root(), namespace, name);
    }

    public static RedisKeys reply(String uuid) {
        return RedisKeys.create(root(), "reply", uuid);
    }

    public static RedisKeys watchAllTopic() {
        return RedisKeys.create(root(), "watch", "all", "topic");
    }

    public static RedisKeys watchAllReply() {
        return RedisKeys.create(root(), "watch","all", "reply");
    }

    public static RedisKeys topicAlive(String name) {
        return RedisKeys.create(root(), name, "alive");
    }

    public static RedisKeys topicIp(String name) {
        return RedisKeys.create(root(), name, "ip", OptionResolver.getInstance().ip());
    }

    public static RedisKeys topicClean(String name) {
        return RedisKeys.create(root(), name, "clean");
    }




//
//    public static RedisKeys watchAliveService(String name) {
//        return RedisKeys.create(root(), "watch","alive", "service", name);
//    }
//
//    public static RedisKeys watchAliveTopic(String name) {
//        return RedisKeys.create(root(), "watch","alive", "topic", name);
//    }
//
//    public static RedisKeys watchIpService(String name) {
//        return RedisKeys.create(root(), "watch","ip", "service", name, OptionResolver.getInstance().ip());
//    }
//
//    public static RedisKeys watchIpTopic(String name) {
//        return RedisKeys.create(root(), "watch","ip", "topic", name, OptionResolver.getInstance().ip());
//    }
//
//    public static RedisKeys replyService(String id, String name) {
//        return RedisKeys.create(root(), "reply", "service", name, id);
//    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy