package com.elab.cache.redis;

import com.elab.cache.error.CacheErrorProcess;
import com.elab.cache.error.impl.SimpleCacheErrorProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 通用redis属性
 *
 * @author Liukx
 * @create 2018-03-06 10:04
 * @email liukx@elab-plus.com
 **/
public class BaseRedis {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    // 缓存异常处理类
    private CacheErrorProcess cacheErrorProcess;
    /**
     * 密码填写,没有则不填
     */
    protected String password;

    /**
     * 数据库索引下标
     */
    protected int dbIndex = 0;

    public void setPassword(String password) {
        this.password = password;
    }

    public void setDbIndex(int dbIndex) {
        this.dbIndex = dbIndex;
    }

    public CacheErrorProcess getCacheErrorProcess() {
        if (cacheErrorProcess == null) {
            cacheErrorProcess = new SimpleCacheErrorProcess();
        }
        return cacheErrorProcess;
    }

    public void setCacheErrorProcess(CacheErrorProcess cacheErrorProcess) {
        this.cacheErrorProcess = cacheErrorProcess;
    }
}
