Serializable[] keys = cache.getMemoryCache().getKeySet().toArray(new Serializable[0]); keys = cache.getMemoryCache().getKeySet().toArray(new Serializable[0]); element = cache.getMemoryCache().getQuiet( key );
Serializable[] keys = cache.getMemoryCache().getKeySet().toArray(new Serializable[0]); keys = cache.getMemoryCache().getKeySet().toArray(new Serializable[0]); element = cache.getMemoryCache().getQuiet( key );
/** * This returns data gathered for this region and all the auxiliaries it currently uses. * <p> * @return Statistics and Info on the Region. */ public ICacheStats getStatistics() { ICacheStats stats = new CacheStats(); stats.setRegionName( this.getCacheName() ); // store the composite cache stats first ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>(); elems.add(new StatElement<Integer>( "HitCountRam", Integer.valueOf(getHitCountRam()) ) ); elems.add(new StatElement<Integer>( "HitCountAux", Integer.valueOf(getHitCountAux()) ) ); stats.setStatElements( elems ); // memory + aux, memory is not considered an auxiliary internally int total = auxCaches.length + 1; ArrayList<IStats> auxStats = new ArrayList<IStats>(total); auxStats.add(getMemoryCache().getStatistics()); for ( AuxiliaryCache<K, V> aux : auxCaches ) { auxStats.add(aux.getStatistics()); } // store the auxiliary stats stats.setAuxiliaryCacheStats( auxStats ); return stats; }
/** * This instructs the memory cache to remove the <i>numberToFree</i> according to its eviction * policy. For example, the LRUMemoryCache will remove the <i>numberToFree</i> least recently * used items. These will be spooled to disk if a disk auxiliary is available. * <p> * @param numberToFree * @return the number that were removed. if you ask to free 5, but there are only 3, you will * get 3. * @throws CacheException */ @Override public int freeMemoryElements( int numberToFree ) throws CacheException { int numFreed = -1; try { numFreed = this.getCacheControl().getMemoryCache().freeElements( numberToFree ); } catch ( IOException ioe ) { String message = "Failure freeing memory elements."; throw new CacheException( message, ioe ); } return numFreed; }
/** * This returns data gathered for this region and all the auxiliaries it currently uses. * <p> * @return Statistics and Info on the Region. */ public ICacheStats getStatistics() { ICacheStats stats = new CacheStats(); stats.setRegionName( this.getCacheName() ); // store the composite cache stats first ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>(); elems.add(new StatElement<Integer>( "HitCountRam", Integer.valueOf(getHitCountRam()) ) ); elems.add(new StatElement<Integer>( "HitCountAux", Integer.valueOf(getHitCountAux()) ) ); stats.setStatElements( elems ); // memory + aux, memory is not considered an auxiliary internally int total = auxCaches.length + 1; ArrayList<IStats> auxStats = new ArrayList<IStats>(total); auxStats.add(getMemoryCache().getStatistics()); for ( AuxiliaryCache<K, V> aux : auxCaches ) { auxStats.add(aux.getStatistics()); } // store the auxiliary stats stats.setAuxiliaryCacheStats( auxStats ); return stats; }
/** * This instructs the memory cache to remove the <i>numberToFree</i> according to its eviction * policy. For example, the LRUMemoryCache will remove the <i>numberToFree</i> least recently * used items. These will be spooled to disk if a disk auxiliary is available. * <p> * @param numberToFree * @return the number that were removed. if you ask to free 5, but there are only 3, you will * get 3. * @throws CacheException */ @Override public int freeMemoryElements( int numberToFree ) throws CacheException { int numFreed = -1; try { numFreed = this.getCacheControl().getMemoryCache().freeElements( numberToFree ); } catch ( IOException ioe ) { String message = "Failure freeing memory elements."; throw new CacheException( message, ioe ); } return numFreed; }
Set<?> allKeysInCache = cache.getMemoryCache().getKeySet(); for (Object keyInCache : allKeysInCache)
if (cache.getMemoryCache() instanceof IRequireScheduler) ((IRequireScheduler)cache.getMemoryCache()).setScheduledExecutorService( compositeCacheManager.getScheduledExecutorService());
Set<?> allKeysInCache = cache.getMemoryCache().getKeySet(); for (Object keyInCache : allKeysInCache)
if (cache.getMemoryCache() instanceof IRequireScheduler) ((IRequireScheduler)cache.getMemoryCache()).setScheduledExecutorService( ccm.getScheduledExecutorService());
MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache(); assertEquals( "Wrong number freed.", numToInsert, memoryCache.lastNumberOfFreedElements );
MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache(); assertEquals( "Wrong number freed.", numToInsert, memoryCache.lastNumberOfFreedElements );
MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache(); assertEquals( "Wrong number freed.", 0, memoryCache.lastNumberOfFreedElements );
MockMemoryCache<String, Integer> memoryCache = (MockMemoryCache<String, Integer>) cache.getMemoryCache(); assertEquals( "Wrong number freed.", 0, memoryCache.lastNumberOfFreedElements );
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();
MockMemoryCache<String, String> memory = (MockMemoryCache<String, String>)cache.getMemoryCache();