net.sf.ehcache.constructs.blocking.CacheEntryFactory Java Examples

The following examples show how to use net.sf.ehcache.constructs.blocking.CacheEntryFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EhCacheSupportTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testEhCacheFactoryBeanWithSelfPopulatingCache() throws Exception {
	EhCacheManagerFactoryBean cacheManagerFb = new EhCacheManagerFactoryBean();
	cacheManagerFb.afterPropertiesSet();
	try {
		CacheManager cm = cacheManagerFb.getObject();
		EhCacheFactoryBean cacheFb = new EhCacheFactoryBean();
		cacheFb.setCacheManager(cm);
		cacheFb.setCacheName("myCache1");
		cacheFb.setCacheEntryFactory(new CacheEntryFactory() {
			@Override
			public Object createEntry(Object key) throws Exception {
				return key;
			}
		});
		assertEquals(cacheFb.getObjectType(), SelfPopulatingCache.class);
		cacheFb.afterPropertiesSet();
		Ehcache myCache1 = cm.getEhcache("myCache1");
		assertTrue(myCache1 instanceof SelfPopulatingCache);
		assertEquals("myKey1", myCache1.get("myKey1").getValue());
	}
	finally {
		cacheManagerFb.destroy();
	}
}
 
Example #2
Source File: EhCacheCachingModel.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public CacheEntryFactory getCacheEntryFactory() {
	return cacheEntryFactory;
}
 
Example #3
Source File: EhCacheFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set an EhCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
 * to use for a self-populating cache. If such a factory is specified,
 * the cache will be decorated with EhCache's
 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
 * <p>The specified factory can be of type
 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
 * which will lead to the use of an
 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
 * <p>Note: Any such self-populating cache is automatically a blocking cache.
 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
 */
public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
	this.cacheEntryFactory = cacheEntryFactory;
}
 
Example #4
Source File: EhCacheFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set an EhCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
 * to use for a self-populating cache. If such a factory is specified,
 * the cache will be decorated with EhCache's
 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
 * <p>The specified factory can be of type
 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
 * which will lead to the use of an
 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
 * <p>Note: Any such self-populating cache is automatically a blocking cache.
 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
 */
public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
	this.cacheEntryFactory = cacheEntryFactory;
}
 
Example #5
Source File: EhCacheFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set an EhCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
 * to use for a self-populating cache. If such a factory is specified,
 * the cache will be decorated with EhCache's
 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
 * <p>The specified factory can be of type
 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
 * which will lead to the use of an
 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
 * <p>Note: Any such self-populating cache is automatically a blocking cache.
 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
 */
public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
	this.cacheEntryFactory = cacheEntryFactory;
}
 
Example #6
Source File: EhCacheFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set an EhCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
 * to use for a self-populating cache. If such a factory is specified,
 * the cache will be decorated with EhCache's
 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
 * <p>The specified factory can be of type
 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
 * which will lead to the use of an
 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
 * <p>Note: Any such self-populating cache is automatically a blocking cache.
 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
 */
public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
	this.cacheEntryFactory = cacheEntryFactory;
}
 
Example #7
Source File: EhCacheCachingModel.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Set an EHCache {@link net.sf.ehcache.constructs.blocking.CacheEntryFactory}
 * to use for a self-populating cache. If such a factory is specified,
 * the cache will be decorated with EHCache's
 * {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}.
 * <p>The specified factory can be of type
 * {@link net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory},
 * which will lead to the use of an
 * {@link net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache}.
 * <p>Note: Any such self-populating cache is automatically a blocking cache.
 *
 * @see net.sf.ehcache.constructs.blocking.SelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCache
 * @see net.sf.ehcache.constructs.blocking.UpdatingCacheEntryFactory
 * @see org.springframework.cache.ehcache.EhCacheFactoryBean#setCacheEntryFactory(net.sf.ehcache.constructs.blocking.CacheEntryFactory)
 */
public void setCacheEntryFactory(CacheEntryFactory cacheEntryFactory) {
	this.cacheEntryFactory = cacheEntryFactory;
}