@Test public void preconfiguredEternalCache() { final CacheManager ehcache = CacheManager.getInstance(); String cacheName = "simpleEternalCache"; assertThat(ehcache.getCache(cacheName).getCacheConfiguration().isEternal(), is(true)); JCacheManager cacheManager = new JCacheManager(null, ehcache, null, null); try { Cache<Object,Object> cache = cacheManager.getCache(cacheName, Object.class, Object.class); assertThat(cache, notNullValue()); JCacheConfiguration config = cache.getConfiguration(JCacheConfiguration.class); assertThat(config, notNullValue()); ExpiryPolicy expiryPolicy = config.getExpiryPolicy(); assertThat(expiryPolicy, notNullValue()); assertDurationNullOrEternal(expiryPolicy.getExpiryForCreation()); assertDurationNullOrEternal(expiryPolicy.getExpiryForAccess()); assertDurationNullOrEternal(expiryPolicy.getExpiryForUpdate()); Object key = "foo"; Object value = "bar"; Object result = cache.getAndPut(key, value); assertThat(result, nullValue()); result = cache.get(key); assertThat(result, is(value)); result = cache.get(key); assertThat(result, is(value)); result = cache.get(key); assertThat(result, is(value)); cache.remove(key); result = cache.get(key); assertThat(result, nullValue()); } finally { ehcache.shutdown(); } }
public ExpiryPolicy getExpiryPolicy() { return expiryPolicy; }
JCacheConfiguration implements javax.cache.configuration.CompleteConfiguration<K, V> { public ExpiryPolicy getExpiryPolicy() { return expiryPolicy; } }
JCacheConfiguration implements javax.cache.configuration.CompleteConfiguration<K, V> { public ExpiryPolicy getExpiryPolicy() { return expiryPolicy; } JCacheConfiguration(final CacheConfiguration cacheConfiguration, final Configuration<K, V> configuration, final Class<K> keyType, final Class<V> valueType);  JCacheConfiguration(final CacheConfiguration cacheConfiguration);  JCacheConfiguration(final Configuration<K, V> configuration); }
JCacheConfiguration implements javax.cache.configuration.CompleteConfiguration<K, V> { public ExpiryPolicy getExpiryPolicy() { return expiryPolicy; } JCacheConfiguration(final CacheConfiguration cacheConfiguration, final Configuration<K, V> configuration, final Class<K> keyType, final Class<V> valueType);  JCacheConfiguration(final CacheConfiguration cacheConfiguration);  JCacheConfiguration(final Configuration<K, V> configuration); @Override Class<K> getKeyType(); @Override Class<V> getValueType(); @Override boolean isStoreByValue(); @Override boolean isReadThrough(); @Override boolean isWriteThrough(); @Override boolean isStatisticsEnabled(); @Override boolean isManagementEnabled(); @Override Iterable<CacheEntryListenerConfiguration<K, V>> getCacheEntryListenerConfigurations(); @Override Factory<CacheLoader<K, V>> getCacheLoaderFactory(); @Override Factory<CacheWriter<? super K, ? super V>> getCacheWriterFactory(); @Override Factory<ExpiryPolicy> getExpiryPolicyFactory(); ExpiryPolicy getExpiryPolicy(); boolean addCacheEntryListenerConfiguration(final CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, final JCacheListenerAdapter<K, V> cacheEventListener); JCacheListenerAdapter<K, V> removeCacheEntryListenerConfiguration(final CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration); Iterable<CacheEntryListenerConfiguration<K, V>> getInitialCacheEntryListenerConfigurations(); boolean overrideDefaultExpiry(); }
JCacheConfiguration implements javax.cache.configuration.CompleteConfiguration<K, V> { public ExpiryPolicy getExpiryPolicy() { return expiryPolicy; } JCacheConfiguration(final CacheConfiguration cacheConfiguration, final Configuration<K, V> configuration, final Class<K> keyType, final Class<V> valueType);  JCacheConfiguration(final CacheConfiguration cacheConfiguration);  JCacheConfiguration(final Configuration<K, V> configuration); @Override Class<K> getKeyType(); @Override Class<V> getValueType(); @Override boolean isStoreByValue(); @Override boolean isReadThrough(); @Override boolean isWriteThrough(); @Override boolean isStatisticsEnabled(); @Override boolean isManagementEnabled(); @Override Iterable<CacheEntryListenerConfiguration<K, V>> getCacheEntryListenerConfigurations(); @Override Factory<CacheLoader<K, V>> getCacheLoaderFactory(); @Override Factory<CacheWriter<? super K, ? super V>> getCacheWriterFactory(); @Override Factory<ExpiryPolicy> getExpiryPolicyFactory(); ExpiryPolicy getExpiryPolicy(); boolean addCacheEntryListenerConfiguration(final CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, final JCacheListenerAdapter<K, V> cacheEventListener); JCacheListenerAdapter<K, V> removeCacheEntryListenerConfiguration(final CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration); Iterable<CacheEntryListenerConfiguration<K, V>> getInitialCacheEntryListenerConfigurations(); boolean overrideDefaultExpiry();  }