package cn.teammodel.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class RedisService {

    private final StringRedisTemplate redisTemplate;


    @Autowired
    public RedisService(StringRedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public void setKeyValue(String key, String value) {
        //ruredisTemplate.slaveOf();
        redisTemplate.opsForValue().set(key, value);
    }

    public Map<Object, Object> getValueByKey(String key) {
        System.out.println(redisTemplate.opsForHash().values("ArtArea:area:primary"));
        return redisTemplate.opsForHash().entries("ArtArea:area:junior");
    }
}
