本文整理匯總了Java中org.springframework.data.redis.cache.RedisCacheManager.setDefaultExpiration方法的典型用法代碼示例。如果您正苦於以下問題:Java RedisCacheManager.setDefaultExpiration方法的具體用法?Java RedisCacheManager.setDefaultExpiration怎麽用?Java RedisCacheManager.setDefaultExpiration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.data.redis.cache.RedisCacheManager
的用法示例。
在下文中一共展示了RedisCacheManager.setDefaultExpiration方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stats
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Primary
@Bean(name = "stats")
public CacheManager stats(RedisTemplate redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setUsePrefix(true);
cacheManager.setDefaultExpiration(TWENTY_MINS_SECS);
return cacheManager;
}
示例2: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
public CacheManager cacheManager ( RedisTemplate redisTemplate ) {
RedisCacheManager redisCacheManager = new RedisCacheManager( redisTemplate );
// 默認30分鍾
redisCacheManager.setDefaultExpiration( defaultExpiration );
redisCacheManager.setExpires( expires );
redisCacheManager.setUsePrefix( usePrefix );
return redisCacheManager;
}
示例3: customize
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Override
public void customize(RedisCacheManager cacheManager) {
Set<String> cacheNames = Sets.newHashSet();
if(properties.getCacheNames()!=null){
cacheNames.addAll(properties.getCacheNames());
}
cacheNames.addAll(getCacheNamesFromProviders());
cacheNames.addAll(properties.getExpires().keySet());
cacheManager.setCacheNames(ImmutableSet.copyOf(cacheNames));
cacheManager.setDefaultExpiration(properties.getDefaultExpirationInSeconds());
cacheManager.setLoadRemoteCachesOnStartup(properties.isLoadRemoteCachesOnStartup());
cacheManager.setUsePrefix(properties.isUsePrefix());
cacheManager.setTransactionAware(properties.isTransactionAware());
Map<String, Long> expires = Maps.newHashMap();
// expires.putAll(getCacheExpiresFromProviders());
expires.putAll(properties.expiresInSeconds());
cacheManager.setExpires(expires);
//GenericJackson2JsonRedisSerializer
}
示例4: redisCacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
@Qualifier("redisTemplate")
public CacheManager redisCacheManager(RedisTemplate<Serializable, Serializable> redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setTransactionAware(true);
cacheManager.setDefaultExpiration(PropertiesUtil.getInt("redis.expiration", 10));
return cacheManager;
}
示例5: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate){
RedisCacheManager redisCacheManager =new RedisCacheManager(redisTemplate);
//設置緩存過期時間
redisCacheManager.setDefaultExpiration(60);//秒
return redisCacheManager;
}
示例6: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
public CacheManager cacheManager() {
RedisTemplate ops = redisTemplate(redisConnectionFactory());
// RedisSerializer ser = ops.getValueSerializer();
RedisCacheManager manager = new RedisCacheManager(ops);
manager.setDefaultExpiration(300);
return manager;
}
示例7: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
@SuppressWarnings("rawtypes")
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate);
redisCacheManager.setDefaultExpiration(60*5); //設置一個默認的過期時間/秒
return redisCacheManager;
}
示例8: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
//設置緩存過期時間
rcm.setDefaultExpiration(60);//秒
return rcm;
}
示例9: longCache
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean(name = "longCache")
public CacheManager longCache(RedisTemplate redisTemplate) {
RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
cacheManager.setUsePrefix(true);
cacheManager.setDefaultExpiration(TEN_HOURS_SECS);
return cacheManager;
}
示例10: userCacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Primary
@Bean(name = "userCacheManager")
public CacheManager userCacheManager() {
RedisCacheManager redisCacheManager = new RedisCacheManager(userRedisTemplate);
redisCacheManager.setDefaultExpiration(3600);
return redisCacheManager;
}
示例11: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager manager = new RedisCacheManager(redisTemplate);
manager.setUsePrefix(true);
RedisCachePrefix cachePrefix = new RedisPrefix("prefix");
manager.setCachePrefix(cachePrefix);
// 整體緩存過期時間
manager.setDefaultExpiration(3600L);
// 設置緩存過期時間。key和緩存過期時間,單位秒
Map<String, Long> expiresMap = new HashMap<>();
expiresMap.put("user", 1000L);
manager.setExpires(expiresMap);
return manager;
}
示例12: customize
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Override
public void customize (RedisCacheManager cacheManager) {
cacheManager.setDefaultExpiration(EXPIRATION_TIMEOUT);
}
示例13: roleCacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean(name = "roleCacheManager")
public CacheManager roleCacheManager() {
RedisCacheManager redisCacheManager = new RedisCacheManager(roleRedisTemplate);
redisCacheManager.setDefaultExpiration(3600);
return redisCacheManager;
}