CompositeCacheManager cacheManager = new CompositeCacheManager(); cacheManager.setCacheManagers(cacheManagers); cacheManager.setFallbackToNoOpCache(false);
/** * Configure with default properties file * @throws CacheException if the configuration cannot be loaded */ public void configure() throws CacheException { configure( CacheConstants.DEFAULT_CONFIG ); }
/** * Flushes all cache items from memory to auxiliary caches and close the auxiliary caches. */ @Override public void dispose() { dispose( false ); }
/** * Do not try to go remote or laterally for this get. * <p> * @param key * @return ICacheElement */ public ICacheElement<K, V> localGet( K key ) { return get( key, true ); }
/** * Standard update method. * <p> * @param ce * @throws IOException */ public void localUpdate( ICacheElement<K, V> ce ) throws IOException { update( ce, true ); }
/** * Build a map of all the matching elements in all of the auxiliaries and memory. Do not try to * go remote or laterally for this data. * <p> * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any matching keys */ public Map<K, ICacheElement<K, V>> localGetMatching( String pattern ) { return getMatching( pattern, true ); }
/** * Puts an item to the cache. * <p> * @param ce * @throws IOException */ @Override public void waterfal( ICacheElement<K, V> ce ) throws IOException { this.cache.spoolToDisk( ce ); }
/** * Gets multiple items from the cache based on the given set of keys. * <p> * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys */ @Override public Map<K, ICacheElement<K, V>> getMultiple( Set<K> keys ) { return getMultiple( keys, false ); }
/** * Simple factory method, must override in subclasses so getInstance creates / returns the * correct object. * <p> * @return CompositeCacheManager */ protected static CompositeCacheManager createInstance() { return new CompositeCacheManager(); }
/** * Get a set of the keys for all elements in the cache * <p> * @return A set of the key type */ public Set<K> getKeySet() { return getKeySet(false); }
/** * @param name */ public void freeCache( String name ) { freeCache( name, false ); }
/** * Will not pass the remove message remotely. * <p> * @throws IOException */ public void localRemoveAll() throws IOException { removeAll( true ); }
/** * Set the default ElementAttributes for new caches. *<p> * @param props */ protected void setDefaultElementAttributes( Properties props ) { IElementAttributes iea = parseElementAttributes( props, "", CompositeCacheConfigurator.DEFAULT_REGION ); compositeCacheManager.setDefaultElementAttributes( iea ); log.info( "setting defaultElementAttributes to " + iea ); }
/** * This returns the stats. * <p> * @return getStats() */ @Override public String toString() { return getStats(); } }
/** * Configure from properties object. * <p> * This method will call configure, instructing it to use system properties as a default. * @param props */ public void configure( Properties props ) { configure( props, DEFAULT_USE_SYSTEM_PROPERTIES ); }
/** * Standard update method. * <p> * @param ce * @throws IOException */ public void localUpdate( ICacheElement<K, V> ce ) throws IOException { update( ce, true ); }
/** * Build a map of all the matching elements in all of the auxiliaries and memory. * <p> * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any matching keys */ @Override public Map<K, ICacheElement<K, V>> getMatching( String pattern ) { return getMatching( pattern, false ); }
/** * Gets multiple items from the cache based on the given set of keys. * <p> * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys */ @Override public Map<K, ICacheElement<K, V>> getMultiple( Set<K> keys ) { return getMultiple( keys, false ); }
/** * Build a map of all the matching elements in all of the auxiliaries and memory. Do not try to * go remote or laterally for this data. * <p> * @param pattern * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any matching keys */ public Map<K, ICacheElement<K, V>> localGetMatching( String pattern ) { return getMatching( pattern, true ); }
/** * Gets multiple items from the cache based on the given set of keys. Do not try to go remote or * laterally for this data. * <p> * @param keys * @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no * data in cache for any of these keys */ public Map<K, ICacheElement<K, V>> localGetMultiple( Set<K> keys ) { return getMultiple( keys, true ); }