派生自 projectDept/qhighschool

yn147
2022-12-09 b34346ac49c1fde71b8e224555d0d8d3dd40cdf4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.qxueyou.scc.config;
 
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;
 
@Configuration
public class RedisCacheConfig extends CachingConfigurerSupport {
 
    @Value("#{${spring.redis.default.ttl}}")
    private int DEFAULT_TTL;
 
 
    @SuppressWarnings("rawtypes")
    @Bean
    public CacheManager cacheManager(RedisTemplate redisTemplate) {
        RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
        cacheManager.setDefaultExpiration(DEFAULT_TTL);
        return cacheManager;
    }
}