Spring Framework CacheInterceptor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework CacheInterceptor class.

This code example shows how to use the following methods:setCacheManager, setCacheOperationSources, setCacheResolver, setErrorHandler, setKeyGenerator
	} 
 
	@Bean 
	@Role(BeanDefinition.ROLE_INFRASTRUCTURE) 
	public CacheInterceptor cacheInterceptor() { 
		CacheInterceptor interceptor = new CacheInterceptor(); 
		interceptor.setCacheOperationSources(cacheOperationSource()); 
		if (this.cacheResolver != null) { 
			interceptor.setCacheResolver(this.cacheResolver); 
		} 
		else if (this.cacheManager != null) { 
			interceptor.setCacheManager(this.cacheManager); 
		} 
		if (this.keyGenerator != null) { 
			interceptor.setKeyGenerator(this.keyGenerator); 
		} 
		if (this.errorHandler != null) { 
			interceptor.setErrorHandler(this.errorHandler); 
		} 
		return interceptor; 

8
CodeRank
This code example shows how to use the following methods:setCacheManager, setCacheOperationSources
		} 
 
		@Bean 
		public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) {
			CacheInterceptor cacheInterceptor = new TestCacheInterceptor();
			cacheInterceptor.setCacheManager(cacheManager());
			cacheInterceptor.setCacheOperationSources(cacheOperationSource);
			return cacheInterceptor;
		} 
	} 
 
	/** 
	 * A test {@link CacheInterceptor} that handles special exception 
	 * types. 
	 */ 
	@SuppressWarnings("serial") 
	static class TestCacheInterceptor extends CacheInterceptor {
 
		@Override 
		protected Object invokeOperation(CacheOperationInvoker invoker) {
6
CodeRank