Java Code Examples for net.sf.ehcache.Cache#getCacheConfiguration()
The following examples show how to use
net.sf.ehcache.Cache#getCacheConfiguration() .
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: EhCacheFactoryBean.java From sakai with Educational Community License v2.0 | 6 votes |
/** * Create a raw Cache object based on the configuration of this FactoryBean. */ protected Cache createCache() { // Only call EHCache 1.6 constructor if actually necessary (for compatibility with EHCache 1.3+) Cache cache = (!this.clearOnFlush) ? new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy, this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle, this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null, this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize, this.clearOnFlush) : new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy, this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle, this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null, this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize); if (this.cacheEventListeners != null) { for (CacheEventListener listener : this.cacheEventListeners) { cache.getCacheEventNotificationService().registerListener(listener); } } if (this.disabled) { cache.setDisabled(true); } net.sf.ehcache.config.CacheConfiguration config = cache.getCacheConfiguration(); config.setMaxEntriesLocalHeap(maxElementsInMemory); return cache; }
Example 2
Source File: EhCacheFactoryBean.java From sakai with Educational Community License v2.0 | 6 votes |
/** * Create a raw Cache object based on the configuration of this FactoryBean. */ protected Cache createCache() { // Only call EHCache 1.6 constructor if actually necessary (for compatibility with EHCache 1.3+) Cache cache = (!this.clearOnFlush) ? new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy, this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle, this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null, this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize, this.clearOnFlush) : new Cache(this.cacheName, this.maxElementsInMemory, this.memoryStoreEvictionPolicy, this.overflowToDisk, null, this.eternal, this.timeToLive, this.timeToIdle, this.diskPersistent, this.diskExpiryThreadIntervalSeconds, null, this.bootstrapCacheLoader, this.maxElementsOnDisk, this.diskSpoolBufferSize); if (this.cacheEventListeners != null) { for (CacheEventListener listener : this.cacheEventListeners) { cache.getCacheEventNotificationService().registerListener(listener); } } if (this.disabled) { cache.setDisabled(true); } net.sf.ehcache.config.CacheConfiguration config = cache.getCacheConfiguration(); config.setMaxEntriesLocalHeap(maxElementsInMemory); return cache; }
Example 3
Source File: EhcachePrivateConstructorInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { Cache cache = (Cache) allArguments[0]; // get cache name if (cache != null && cache.getCacheConfiguration() != null) { objInst.setSkyWalkingDynamicField(new EhcacheEnhanceInfo(cache.getCacheConfiguration().getName())); } }
Example 4
Source File: CacheInformationProvider.java From gocd with Apache License 2.0 | 5 votes |
public Map<String, Object> getCacheConfigurationInformationAsJson(Cache cache) { CacheConfiguration config = cache.getCacheConfiguration(); LinkedHashMap<String, Object> json = new LinkedHashMap<>(); json.put("Name", config.getName()); json.put("Maximum Elements in Memory", config.getMaxEntriesLocalHeap()); json.put("Maximum Elements on Disk", config.getMaxBytesLocalDisk()); json.put("Memory Store Eviction Policy", config.getMemoryStoreEvictionPolicy().toString()); json.put("Clean or Flush", config.isClearOnFlush()); json.put("Eternal", config.isEternal()); json.put("Time To Idle Seconds", config.getTimeToIdleSeconds()); json.put("time To Live Seconds", config.getTimeToLiveSeconds()); if (config.getPersistenceConfiguration() != null) { json.put("Persistence Configuration Strategy", config.getPersistenceConfiguration().getStrategy()); json.put("Persistence Configuration Synchronous writes", config.getPersistenceConfiguration().getSynchronousWrites()); } else { json.put("Persistence Configuration Strategy", "NONE"); json.put("Persistence Configuration Synchronous writes", false); } json.put("Disk Spool Buffer Size in MB", config.getDiskSpoolBufferSizeMB()); json.put("Disk Access Stripes", config.getDiskAccessStripes()); json.put("Disk Expiry Thread Interval Seconds", config.getDiskExpiryThreadIntervalSeconds()); json.put("Logging Enabled", config.getLogging()); json.put("Terracotta Configuration", config.getTerracottaConfiguration()); json.put("Cache Writer Configuration", config.getCacheWriterConfiguration()); json.put("Cache Loader Configurations", config.getCacheLoaderConfigurations()); json.put("Frozen", config.isFrozen()); json.put("Transactional Mode", config.getTransactionalMode()); json.put("Statistics Enabled", config.getStatistics()); return json; }