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


Java RedisCacheManager類代碼示例

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


RedisCacheManager類屬於org.springframework.data.redis.cache包,在下文中一共展示了RedisCacheManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
 
開發者ID:celestial-winter,項目名稱:vics,代碼行數:9,代碼來源:CacheConfig.java

示例2: 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;
}
 
開發者ID:ChinaLHR,項目名稱:JavaQuarkBBS,代碼行數:9,代碼來源:RedisConfig.java

示例3: 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

示例4: 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

示例5: 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;
}
 
開發者ID:iBase4J,項目名稱:iBase4J-Common,代碼行數:9,代碼來源:JedisConfig.java

示例6: cacheManager

import org.springframework.data.redis.cache.RedisCacheManager; //導入依賴的package包/類
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate){
    RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
    //設置緩存過期時間
    //rcm.setDefaultExpiration(60);//秒
    return rcm;
}
 
開發者ID:MIYAOW,項目名稱:MI-S,代碼行數:8,代碼來源:RedisConfig.java

示例7: 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;
}
 
開發者ID:SnackMen,項目名稱:DanmuChat,代碼行數:9,代碼來源:RedisConfig.java

示例8: 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;
    }
 
開發者ID:Azure,項目名稱:CityPower-Build-Sample,代碼行數:10,代碼來源:CacheConfig.java

示例9: 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;
}
 
開發者ID:lemon-china,項目名稱:lemon-dubbo-message,代碼行數:8,代碼來源:RedisConfiguration.java

示例10: 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;
}
 
開發者ID:finefuture,項目名稱:data-migration,代碼行數:9,代碼來源:RedisConfiguration.java

示例11: getCacheNames

import org.springframework.data.redis.cache.RedisCacheManager; //導入依賴的package包/類
@Override
public Collection<String> getCacheNames() {
    Set<String> cacheNames = Collections.emptySet();
    for (RedisCacheManager redisCacheManager : hashWheel.getHotspots()) {
        cacheNames.addAll(redisCacheManager.getCacheNames());
    }
    return cacheNames;
}
 
開發者ID:Fourwenwen,項目名稱:consistent-hashing-redis,代碼行數:9,代碼來源:HwRedisCacheManager.java

示例12: 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;
}
 
開發者ID:rajadilipkolli,項目名稱:springsecuredthymeleafapp,代碼行數:11,代碼來源:RedisConfiguration.java

示例13: 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;
}
 
開發者ID:celestial-winter,項目名稱:vics,代碼行數:8,代碼來源:CacheConfig.java

示例14: redisCacheExplicit

import org.springframework.data.redis.cache.RedisCacheManager; //導入依賴的package包/類
@Test
public void redisCacheExplicit() {
	load(RedisCacheConfiguration.class, "spring.cache.type=redis");
	RedisCacheManager cacheManager = validateCacheManager(RedisCacheManager.class);
	assertThat(cacheManager.getCacheNames()).isEmpty();
	assertThat((Boolean) new DirectFieldAccessor(cacheManager)
			.getPropertyValue("usePrefix")).isTrue();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:9,代碼來源:CacheAutoConfigurationTests.java

示例15: redisCacheExplicitWithCaches

import org.springframework.data.redis.cache.RedisCacheManager; //導入依賴的package包/類
@Test
public void redisCacheExplicitWithCaches() {
	load(RedisCacheConfiguration.class, "spring.cache.type=redis",
			"spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
	RedisCacheManager cacheManager = validateCacheManager(RedisCacheManager.class);
	assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:CacheAutoConfigurationTests.java


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