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

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

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

import java.time.Duration;
import java.util.Collections;
import java.util.List;

import com.github.lontime.extredisson.common.WatchKind;
import lombok.Getter;
import lombok.Setter;

import static com.github.lontime.extredisson.common.Constants.SERVICE_REPLYS;

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

    private Boolean enabled = Boolean.TRUE;

    /**
     * interval.
     */
    private Duration interval = Duration.ofSeconds(1);

    /**
     * warmup.
     */
    private Duration warmup = Duration.ofSeconds(2);

    /**
     * desc.
     */
    private List specs = Collections.emptyList();

    /**
     * enableStream.
     */
    private Boolean enableStream = false;

    /**
     * serviceReply.
     */
    private Boolean enableServiceReply = true;

    /**
     * serviceReply.
     */
    private Spec serviceReply = Spec.defaultServiceReply();


    @Getter
    @Setter
    public static class Spec {
        /**
         * name.
         */
        private String name;

        /**
         * kind.
         */
        private WatchKind kind = WatchKind.ZSET;

        /**
         * maxLen.
         */
        private Integer maxLen = 200000;

        /**
         * maxLenRate.
         */
        private Double maxLenRate = 1.1d;

        /**
         * timeToLive.
         */
        private Duration timeToLive = Duration.ofHours(2);

        /**
         * lockWaitTime.
         */
        private Duration lockWaitTime = Duration.ofMillis(500);

        /**
         * lockLeaseTime.
         */
        private Duration lockLeaseTime = Duration.ofMinutes(5);

        /**
         * batchSize.
         */
        private Integer batchSize = 100;

        public static Spec defaultServiceReply() {
            final Spec spec = new Spec();
            spec.setName(SERVICE_REPLYS);
            spec.setKind(WatchKind.REPLY);
            return spec;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy