package com.gyee.frame.common.conf.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;


@Configuration
public class CacheContext {
    @Autowired
    private CacheConfig cacheConfig;
    @Autowired
    private RedisTemplate redisTemplate;
    public <T> T getObjectFromCache(String str){

        byte[] by = (byte[])redisTemplate.opsForValue().get(str);
        T t = (T)cacheConfig.deserialize(by);
        return t;
    }
}
