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


Java SimpleKeyGenerator类代码示例

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


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

示例1: getFail

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Test
public void getFail() {
	UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on get");
	Object key = SimpleKeyGenerator.generateKey(0L);
	willThrow(exception).given(cache).get(key);

	this.simpleService.get(0L);
	verify(errorHandler).handleCacheGetError(exception, cache, key);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:JCacheErrorHandlerTests.java

示例2: putFail

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Test
public void putFail() {
	UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on put");
	Object key = SimpleKeyGenerator.generateKey(0L);
	willThrow(exception).given(cache).put(key, 234L);

	this.simpleService.put(0L, 234L);
	verify(errorHandler).handleCachePutError(exception, cache, key, 234L);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:JCacheErrorHandlerTests.java

示例3: evictFail

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Test
public void evictFail() {
	UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict");
	Object key = SimpleKeyGenerator.generateKey(0L);
	willThrow(exception).given(cache).evict(key);

	this.simpleService.evict(0L);
	verify(errorHandler).handleCacheEvictError(exception, cache, key);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:JCacheErrorHandlerTests.java

示例4: earlyPut

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
@CachePut(afterInvocation = false)
public void earlyPut(String id, @CacheValue Object value) {
	Object key = SimpleKeyGenerator.generateKey(id);
	Cache.ValueWrapper valueWrapper = defaultCache.get(key);
	if (valueWrapper == null) {
		throw new AssertionError("Excepted value to be put in cache with key " + key);
	}
	Object actual = valueWrapper.get();
	if (value != actual) { // instance check on purpose
		throw new AssertionError("Wrong value set in cache with key " + key + ". " +
				"Expected=" + value + ", but got=" + actual);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:AnnotatedJCacheableService.java

示例5: earlyRemove

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
@CacheRemove(afterInvocation = false)
public void earlyRemove(String id) {
	Object key = SimpleKeyGenerator.generateKey(id);
	Cache.ValueWrapper valueWrapper = defaultCache.get(key);
	if (valueWrapper != null) {
		throw new AssertionError("Value with key " + key + " expected to be already remove from cache");
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AnnotatedJCacheableService.java

示例6: generate

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
// Exception squid:S923 - override
@SuppressWarnings({ "squid:S923" })
public Object generate(final Object target, final Method method, final Object... params) {
    final String initialTenantCreation = createInitialTenant.get();
    if (initialTenantCreation == null) {
        return SimpleKeyGenerator.generateKey(tenantAware.getCurrentTenant().toUpperCase(),
                tenantAware.getCurrentTenant().toUpperCase());
    }
    return SimpleKeyGenerator.generateKey(initialTenantCreation.toUpperCase(),
            initialTenantCreation.toUpperCase());
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:13,代码来源:SystemManagementCacheKeyGenerator.java

示例7: generate

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
public Object generate(Object target, Method method, Object... params) {
    if (params.length == 1) {
        CacheDefinition cacheDefinition = classCacheDefinitionMap.get(params[0].getClass());
        if (cacheDefinition != null) {
            return cacheDefinition.generateKey(target, method, params);
        }
    }
    return SimpleKeyGenerator.generateKey(params);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:11,代码来源:CachingConfig.java

示例8: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Bean
@Override
public KeyGenerator keyGenerator() {
    return new SimpleKeyGenerator();
}
 
开发者ID:onsoul,项目名称:os,代码行数:6,代码来源:CachingConfig.java

示例9: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
@Bean
public KeyGenerator keyGenerator() {
	return new SimpleKeyGenerator();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:JCacheEhCacheAnnotationTests.java

示例10: createKey

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
private Object createKey(Object... params) {
	return SimpleKeyGenerator.generateKey(params);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:4,代码来源:AbstractJCacheAnnotationTests.java

示例11: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
public KeyGenerator keyGenerator() {
	return new SimpleKeyGenerator();
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:5,代码来源:CacheConfiguration.java

示例12: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
@Bean
public KeyGenerator keyGenerator() {
    return new SimpleKeyGenerator();
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:6,代码来源:CacheConfiguration.java

示例13: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Override
public KeyGenerator keyGenerator() {
    return new SimpleKeyGenerator();
}
 
开发者ID:ozwillo,项目名称:ozwillo-portal,代码行数:5,代码来源:PortalCoreConfiguration.java

示例14: keyGenerator

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
@Bean
@Override
public KeyGenerator keyGenerator() {
	return new SimpleKeyGenerator();
}
 
开发者ID:fastnsilver,项目名称:fns-projects,代码行数:6,代码来源:CacheConfig.java

示例15: generateKey

import org.springframework.cache.interceptor.SimpleKeyGenerator; //导入依赖的package包/类
default Object generateKey(Object target, Method method, Object... params) {
    return SimpleKeyGenerator.generateKey(params);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:4,代码来源:CacheDefinition.java


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