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

com.github.lontime.extredisson.configuration.NodeOption Maven / Gradle / Ivy

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

import java.time.Duration;

import com.github.lontime.base.commonj.utils.UuidHelper;
import com.github.lontime.base.logging.GLogger;
import com.github.lontime.extredisson.common.RedisKeys;
import lombok.Getter;
import lombok.Setter;

/**
 * NodeOption.
 * @author lontime
 * @since 1.0
 */
@Getter
@Setter
public class NodeOption {

    private String id;

    private String namespace;

    private Duration period = Duration.ofSeconds(5);

    private Duration ttl = Duration.ofSeconds(20);


    public static NodeOption create() {
        return create(UuidHelper.fastUUID());
    }

    public static NodeOption create(String uuid) {
        final NodeOption option = new NodeOption();
        option.setId(uuid);
        option.setNamespace(RedisKeys.NODE_ALL.getFullName());
        GLogger.node().infov("******************* Node ID [ {0} ] *******************", uuid);
        return option;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy