本文整理匯總了Java中org.springframework.data.redis.cache.RedisCacheManager.setTransactionAware方法的典型用法代碼示例。如果您正苦於以下問題:Java RedisCacheManager.setTransactionAware方法的具體用法?Java RedisCacheManager.setTransactionAware怎麽用?Java RedisCacheManager.setTransactionAware使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.data.redis.cache.RedisCacheManager
的用法示例。
在下文中一共展示了RedisCacheManager.setTransactionAware方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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
}
示例2: 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;
}
示例3: cacheManager
import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Bean
@Override
public RedisCacheManager cacheManager() {
RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate());
redisCacheManager.setTransactionAware(true);
redisCacheManager.setLoadRemoteCachesOnStartup(true);
redisCacheManager.setUsePrefix(true);
return redisCacheManager;
}