当前位置: 首页>>代码示例>>Java>>正文


Java RedisCache类代码示例

本文整理汇总了Java中org.springframework.data.redis.cache.RedisCache的典型用法代码示例。如果您正苦于以下问题:Java RedisCache类的具体用法?Java RedisCache怎么用?Java RedisCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RedisCache类属于org.springframework.data.redis.cache包,在下文中一共展示了RedisCache类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
@Override
	protected RedisCache createCache(String cacheName) {
//		if(cacheName.equals("token")) {
//			return new RedisCache(cacheName, "token:".getBytes(), this.ops, 24*60*60);
//		}

		return super.createCache(cacheName);
	}
 
开发者ID:nonocast,项目名称:todolist,代码行数:9,代码来源:AppCacheManager.java

示例2: getCacheStatistics

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
@Override
public CacheStatistics getCacheStatistics(CacheManager cacheManager, RedisCache cache) {
    DefaultCacheStatistics statistics = new DefaultCacheStatistics();
    // @see http://redis.io/commands/INFO
    RedisConnection connection = RedisConnectionUtils.getConnection(this.redisConnectionFactory);
    try {
        Properties props = connection.info();
        Long hitCount = Long.parseLong(props.getProperty("keyspace_hits"));
        Long missCount = Long.parseLong(props.getProperty("keyspace_misses"));
        statistics.setGetCacheCounts(hitCount, missCount);
    } finally {
        RedisConnectionUtils.releaseConnection(connection, this.redisConnectionFactory);
    }
    return statistics;
}
 
开发者ID:fastnsilver,项目名称:xlator,代码行数:16,代码来源:RedisCacheStatisticsProvider.java

示例3: getMissingCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
@Override
protected Cache getMissingCache(String name) {
    RedisTemplate<? extends Object, ? extends Object> template = this.templates.get(name);
    Long expiration = this.expires.get(name);
    RedisCache cache = createCache(name, template, expiration);
    return cache;
}
 
开发者ID:microacup,项目名称:microbbs,代码行数:8,代码来源:RedisCacheManager.java

示例4: withCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
public RedisCacheManager withCache(String cacheName, RedisTemplate template, long expiration) {
    this.templates.put(cacheName, template);
    this.expires.put(cacheName, expiration);
    RedisCache cache = createCache(cacheName, template, expiration);
    addCache(cache);
    return this;
}
 
开发者ID:spring-io,项目名称:sagan,代码行数:8,代码来源:RedisCacheManager.java

示例5: init

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
public void init() {
    template = SpringUtil.getBean("redisTemplate");//RedisCacheConfig中定义了
    cache = new RedisCache(CACHE_NAME, CACHE_NAME.getBytes(), template, EXPIRE_TIME);
}
 
开发者ID:ZHENFENG13,项目名称:perfect-ssm,代码行数:5,代码来源:RedisUtil.java

示例6: createCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
protected RedisCache createCache(String cacheName) {
    long expiration = computeExpiration(cacheName);
    return new CustomRedisCache(cacheName, (isUsePrefix() ? getCachePrefix().prefix(cacheName) : null),
            getRedisOperations(), expiration);
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:6,代码来源:CustomRedisCacheManager.java

示例7: createCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
protected RedisCache createCache(String cacheName, RedisTemplate<? extends Object, ? extends Object> template, long expiration) {
    return new RedisCache(cacheName, (usePrefix ? cachePrefix.prefix(cacheName) : null), template, expiration);
}
 
开发者ID:microacup,项目名称:microbbs,代码行数:4,代码来源:RedisCacheManager.java

示例8: createCache

import org.springframework.data.redis.cache.RedisCache; //导入依赖的package包/类
protected RedisCache createCache(String cacheName, RedisTemplate template, long expiration) {
    return new RedisCache(cacheName, (usePrefix ? cachePrefix.prefix(cacheName) : null), template, expiration);
}
 
开发者ID:spring-io,项目名称:sagan,代码行数:4,代码来源:RedisCacheManager.java


注:本文中的org.springframework.data.redis.cache.RedisCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。