package com.gyee.frame.common.cache;

import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

import javax.annotation.Resource;
@Service
public class RedisUtils {

    @Resource
    private  JedisPool jedisPool;



    public  String get(String key, int indexdb) {
        Jedis jedis = null;
        String value = null;

        try {
            jedis = jedisPool.getResource();//获取一个jedis实例
            jedis.select(indexdb);
            value = jedis.get(key);
        } catch (Exception e) {
        System.out.println(e.getMessage());
        } finally {
            jedis.close();
        }
        return value;
    }
}
