package com.elab.redis;

import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.*;

/**
 * 缓存直接操作类
 *
 * @author ： liukx
 * @time ： 2020/7/8 - 16:53
 */
public class CacheTemplate {

    private Logger logger = LoggerFactory.getLogger(CacheTemplate.class);

    private RedissonClient redissonClient;

    private Long timeOut;

    private RedisTemplate<String, Object> redisTemplate;

    public ValueOperations string() {
        return redisTemplate.opsForValue();
    }

    public RedissonClient getRedissonClient() {
        return redissonClient;
    }

    public void setRedissonClient(RedissonClient redissonClient) {
        this.redissonClient = redissonClient;
    }

    public RedisTemplate<String, Object> getRedisTemplate() {
        return redisTemplate;
    }

    public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public HashOperations map() {
        return redisTemplate.opsForHash();
    }

    public ListOperations list() {
        return redisTemplate.opsForList();
    }

    public SetOperations set() {
        return redisTemplate.opsForSet();
    }

    public ZSetOperations zset() {
        return redisTemplate.opsForZSet();
    }

}

