當前位置: 首頁>>代碼示例>>Java>>正文


Java RedisCacheManager.setExpires方法代碼示例

本文整理匯總了Java中org.springframework.data.redis.cache.RedisCacheManager.setExpires方法的典型用法代碼示例。如果您正苦於以下問題:Java RedisCacheManager.setExpires方法的具體用法?Java RedisCacheManager.setExpires怎麽用?Java RedisCacheManager.setExpires使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.data.redis.cache.RedisCacheManager的用法示例。


在下文中一共展示了RedisCacheManager.setExpires方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
 
開發者ID:yujunhao8831,項目名稱:spring-boot-start-current,代碼行數:10,代碼來源:SpringCacheConfig.java

示例2: 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
	}
 
開發者ID:wayshall,項目名稱:onetwo,代碼行數:22,代碼來源:RedisCacheManagerCustomizers.java

示例3: 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;
}
 
開發者ID:zheng-zy,項目名稱:spring-boot-redis-guava-caffeine-cache,代碼行數:15,代碼來源:RedisConfig.java

示例4: redisCacheManager

import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
public RedisCacheManager redisCacheManager(){
    RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate());
    Map<String, Long> keyMap = new HashMap<>();
    keyMap.put("user", 100L);
    cacheManager.setExpires(keyMap);
    return cacheManager;
}
 
開發者ID:RizkiMufrizal,項目名稱:Belajar-Oauth2,代碼行數:9,代碼來源:WebApplication.java

示例5: redisCacheManager

import org.springframework.data.redis.cache.RedisCacheManager; //導入方法依賴的package包/類
@Bean
public RedisCacheManager redisCacheManager(){
    RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate());
    Map<String, Long> keyMap = new HashMap<>();
    keyMap.put("barang", 100L);
    cacheManager.setExpires(keyMap);
    return cacheManager;
}
 
開發者ID:RizkiMufrizal,項目名稱:Belajar-Oauth2,代碼行數:9,代碼來源:WebApplication.java


注:本文中的org.springframework.data.redis.cache.RedisCacheManager.setExpires方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。