@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised"); fail(); } catch (IllegalStateException e) { } }
public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration);  Cache(CacheConfiguration cacheConfiguration,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
                 boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 boolean overflowToDisk,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB,
                 boolean clearOnFlush);  Cache(String name, int maxElementsInMemory, MemoryStoreEvictionPolicy memoryStoreEvictionPolicy, boolean overflowToDisk,
                 String diskStorePath, boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds, boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds, RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader, int maxElementsOnDisk, int diskSpoolBufferSizeMB, boolean clearOnFlush,
                 boolean isTerracottaClustered, String terracottaValueMode, boolean terracottaCoherentReads); }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration);  Cache(CacheConfiguration cacheConfiguration,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
                 boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 boolean overflowToDisk,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB,
                 boolean clearOnFlush);  Cache(String name, int maxElementsInMemory, MemoryStoreEvictionPolicy memoryStoreEvictionPolicy, boolean overflowToDisk,
                 String diskStorePath, boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds, boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds, RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader, int maxElementsOnDisk, int diskSpoolBufferSizeMB, boolean clearOnFlush,
                 boolean isTerracottaClustered, String terracottaValueMode, boolean terracottaCoherentReads); TransactionManagerLookup getTransactionManagerLookup(); void setTransactionManagerLookup(TransactionManagerLookup lookup); void initialise(); CacheWriterManager getWriterManager(); boolean isTerracottaClustered(); void bootstrap(); final void put(Element element); final void put(Element element, boolean doNotNotifyCacheReplicators); void putWithWriter(Element element); final void putQuiet(Element element); final Element get(Serializable key); final Element get(Object key); Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument); void load(final Object key); Map getAllWithLoader(Collection keys, Object loaderArgument); void loadAll(final Collection keys, final Object argument); final Element getQuiet(Serializable key); final Element getQuiet(Object key); final List getKeys(); final List getKeysWithExpiryCheck(); final List getKeysNoDuplicateCheck(); final boolean remove(Serializable key); final boolean remove(Object key); final boolean remove(Serializable key, boolean doNotNotifyCacheReplicators); final boolean remove(Object key, boolean doNotNotifyCacheReplicators); final boolean removeQuiet(Serializable key); final boolean removeQuiet(Object key); boolean removeWithWriter(Object key); void removeAll(); void removeAll(boolean doNotNotifyCacheReplicators); synchronized void dispose(); CacheConfiguration getCacheConfiguration(); final synchronized void flush(); final int getSize(); int getSizeBasedOnAccuracy(int statisticsAccuracy); final long calculateInMemorySize(); final long calculateOffHeapSize(); final long getMemoryStoreSize(); long getOffHeapStoreSize(); final int getDiskStoreSize(); final Status getStatus(); final String getName(); final void setName(String name); @Override String toString(); final boolean isExpired(Element element); @Override final Cache clone(); final Object getStoreMBean(); final RegisteredEventListeners getCacheEventNotificationService(); final boolean isElementInMemory(Serializable key); final boolean isElementInMemory(Object key); final boolean isElementOffHeap(Object key); final boolean isElementOnDisk(Serializable key); final boolean isElementOnDisk(Object key); final String getGuid(); final CacheManager getCacheManager(); void clearStatistics(); int getStatisticsAccuracy(); void setStatisticsAccuracy(int statisticsAccuracy); void evictExpiredElements(); boolean isKeyInCache(Object key); boolean isValueInCache(Object value); Statistics getStatistics(); void setCacheManager(CacheManager cacheManager); BootstrapCacheLoader getBootstrapCacheLoader(); void setBootstrapCacheLoader(BootstrapCacheLoader bootstrapCacheLoader); void setDiskStorePath(String diskStorePath); @Override boolean equals(Object object); @Override int hashCode(); void registerCacheExtension(CacheExtension cacheExtension); List<CacheExtension> getRegisteredCacheExtensions(); void unregisterCacheExtension(CacheExtension cacheExtension); float getAverageGetTime(); void setCacheExceptionHandler(CacheExceptionHandler cacheExceptionHandler); CacheExceptionHandler getCacheExceptionHandler(); void registerCacheLoader(CacheLoader cacheLoader); void unregisterCacheLoader(CacheLoader cacheLoader); List<CacheLoader> getRegisteredCacheLoaders(); void registerCacheWriter(CacheWriter cacheWriter); void unregisterCacheWriter(); CacheWriter getRegisteredCacheWriter(); boolean isDisabled(); void setDisabled(boolean disabled); Policy getMemoryStoreEvictionPolicy(); void setMemoryStoreEvictionPolicy(Policy policy); LiveCacheStatistics getLiveCacheStatistics(); void registerCacheUsageListener(CacheUsageListener cacheUsageListener); void removeCacheUsageListener(CacheUsageListener cacheUsageListener); boolean isStatisticsEnabled(); void setStatisticsEnabled(boolean enableStatistics); SampledCacheStatistics getSampledCacheStatistics(); void setSampledStatisticsEnabled(final boolean enableStatistics); boolean isSampledStatisticsEnabled(); Object getInternalContext(); void disableDynamicFeatures(); boolean isClusterCoherent(); boolean isNodeCoherent(); void setNodeCoherent(boolean coherent); void waitUntilClusterCoherent(); synchronized void addPropertyChangeListener(PropertyChangeListener listener); synchronized void removePropertyChangeListener(PropertyChangeListener listener); void firePropertyChange(String propertyName, Object oldValue, Object newValue); Element putIfAbsent(Element element); boolean removeElement(Element element); boolean replace(Element old, Element element); Element replace(Element element); void clusterCoherent(boolean clusterCoherent); void nodeCoherent(boolean nodeCoherent); Attribute<T> getSearchAttribute(String attributeName); Query createQuery(); boolean isSearchable(); }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration);  Cache(CacheConfiguration cacheConfiguration,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
                 boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 boolean overflowToDisk,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB);  Cache(String name,
                 int maxElementsInMemory,
                 MemoryStoreEvictionPolicy memoryStoreEvictionPolicy,
                 boolean overflowToDisk,
                 String diskStorePath,
                 boolean eternal,
                 long timeToLiveSeconds,
                 long timeToIdleSeconds,
                 boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds,
                 RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader,
                 int maxElementsOnDisk,
                 int diskSpoolBufferSizeMB,
                 boolean clearOnFlush);  Cache(String name, int maxElementsInMemory, MemoryStoreEvictionPolicy memoryStoreEvictionPolicy, boolean overflowToDisk,
                 String diskStorePath, boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds, boolean diskPersistent,
                 long diskExpiryThreadIntervalSeconds, RegisteredEventListeners registeredEventListeners,
                 BootstrapCacheLoader bootstrapCacheLoader, int maxElementsOnDisk, int diskSpoolBufferSizeMB, boolean clearOnFlush,
                 boolean isTerracottaClustered, String terracottaValueMode, boolean terracottaCoherentReads); TransactionManagerLookup getTransactionManagerLookup(); void setTransactionManagerLookup(TransactionManagerLookup lookup); void initialise(); CacheWriterManager getWriterManager(); boolean isTerracottaClustered(); void bootstrap(); final void put(Element element); final void put(Element element, boolean doNotNotifyCacheReplicators); void putWithWriter(Element element); final void putQuiet(Element element); final Element get(Serializable key); final Element get(Object key); Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument); void load(final Object key); Map getAllWithLoader(Collection keys, Object loaderArgument); void loadAll(final Collection keys, final Object argument); final Element getQuiet(Serializable key); final Element getQuiet(Object key); final List getKeys(); final List getKeysWithExpiryCheck(); final List getKeysNoDuplicateCheck(); final boolean remove(Serializable key); final boolean remove(Object key); final boolean remove(Serializable key, boolean doNotNotifyCacheReplicators); final boolean remove(Object key, boolean doNotNotifyCacheReplicators); final boolean removeQuiet(Serializable key); final boolean removeQuiet(Object key); boolean removeWithWriter(Object key); void removeAll(); void removeAll(boolean doNotNotifyCacheReplicators); synchronized void dispose(); CacheConfiguration getCacheConfiguration(); final synchronized void flush(); final int getSize(); int getSizeBasedOnAccuracy(int statisticsAccuracy); final long calculateInMemorySize(); final long calculateOffHeapSize(); final long getMemoryStoreSize(); long getOffHeapStoreSize(); final int getDiskStoreSize(); final Status getStatus(); final String getName(); final void setName(String name); @Override String toString(); final boolean isExpired(Element element); @Override final Cache clone(); final Object getStoreMBean(); final RegisteredEventListeners getCacheEventNotificationService(); final boolean isElementInMemory(Serializable key); final boolean isElementInMemory(Object key); final boolean isElementOffHeap(Object key); final boolean isElementOnDisk(Serializable key); final boolean isElementOnDisk(Object key); final String getGuid(); final CacheManager getCacheManager(); void clearStatistics(); int getStatisticsAccuracy(); void setStatisticsAccuracy(int statisticsAccuracy); void evictExpiredElements(); boolean isKeyInCache(Object key); boolean isValueInCache(Object value); Statistics getStatistics(); void setCacheManager(CacheManager cacheManager); BootstrapCacheLoader getBootstrapCacheLoader(); void setBootstrapCacheLoader(BootstrapCacheLoader bootstrapCacheLoader); void setDiskStorePath(String diskStorePath); @Override boolean equals(Object object); @Override int hashCode(); void registerCacheExtension(CacheExtension cacheExtension); List<CacheExtension> getRegisteredCacheExtensions(); void unregisterCacheExtension(CacheExtension cacheExtension); float getAverageGetTime(); void setCacheExceptionHandler(CacheExceptionHandler cacheExceptionHandler); CacheExceptionHandler getCacheExceptionHandler(); void registerCacheLoader(CacheLoader cacheLoader); void unregisterCacheLoader(CacheLoader cacheLoader); List<CacheLoader> getRegisteredCacheLoaders(); void registerCacheWriter(CacheWriter cacheWriter); void unregisterCacheWriter(); CacheWriter getRegisteredCacheWriter(); boolean isDisabled(); void setDisabled(boolean disabled); Policy getMemoryStoreEvictionPolicy(); void setMemoryStoreEvictionPolicy(Policy policy); LiveCacheStatistics getLiveCacheStatistics(); void registerCacheUsageListener(CacheUsageListener cacheUsageListener); void removeCacheUsageListener(CacheUsageListener cacheUsageListener); boolean isStatisticsEnabled(); void setStatisticsEnabled(boolean enableStatistics); SampledCacheStatistics getSampledCacheStatistics(); void setSampledStatisticsEnabled(final boolean enableStatistics); boolean isSampledStatisticsEnabled(); Object getInternalContext(); void disableDynamicFeatures(); boolean isClusterCoherent(); boolean isNodeCoherent(); void setNodeCoherent(boolean coherent); void waitUntilClusterCoherent(); synchronized void addPropertyChangeListener(PropertyChangeListener listener); synchronized void removePropertyChangeListener(PropertyChangeListener listener); void firePropertyChange(String propertyName, Object oldValue, Object newValue); Element putIfAbsent(Element element); boolean removeElement(Element element); boolean replace(Element old, Element element); Element replace(Element element); void clusterCoherent(boolean clusterCoherent); void nodeCoherent(boolean nodeCoherent); Attribute<T> getSearchAttribute(String attributeName); Query createQuery(); boolean isSearchable(); static final String DEFAULT_CACHE_NAME; static final String NET_SF_EHCACHE_DISABLED; static final String NET_SF_EHCACHE_USE_CLASSIC_LRU; static final long DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS; }