/** * Puts an item to the cache. Removes any pre-existing entries of the same key from the linked * list and adds this one first. * <p> * @param ce The cache element, or entry wrapper * @return MemoryElementDescriptor the new node * @throws IOException */ @Override protected MemoryElementDescriptor<K, V> adjustListForUpdate( ICacheElement<K, V> ce ) throws IOException { return addFirst( ce ); }
CompositeCache<String, String> cache = cacheMgr.getCache( region ); LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>(); lru.initialize( cache ); lru.update( ice ); assertNull( "Should not have " + i + ":key", lru.get( i + ":key" ) ); String value = lru.get( i + ":key" ).getVal(); assertEquals( region + " data " + i, value ); Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) lru.remove( i + ":key" ); assertNull( "Removed key should be null: " + i + ":key", lru.get( i + ":key" ) );
this.memCache = new LRUMemoryCache<K, V>(); this.memCache.initialize( this );
CompositeCache<String, String> cache = cacheMgr.getCache( region ); LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>(); lru.initialize( cache ); lru.update( ice ); assertNull( "Should not have " + i + ":key", lru.get( i + ":key" ) ); String value = lru.get( i + ":key" ).getVal(); assertEquals( region + " data " + i, value ); Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) lru.remove( i + ":key" ); assertNull( "Removed key should be null: " + i + ":key", lru.get( i + ":key" ) );
this.memCache = new LRUMemoryCache<K, V>(); this.memCache.initialize( this );
CompositeCache<String, String> cache = cacheMgr.getCache( region ); LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>(); lru.initialize( cache ); lru.update( ice ); assertNull( "Should not have " + i + ":key", lru.get( i + ":key" ) ); String value = lru.get( i + ":key" ).getVal(); assertEquals( region + " data " + i, value ); Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) lru.remove( i + ":key" ); assertNull( "Removed key should be null: " + i + ":key", lru.get( i + ":key" ) );
/** * Puts an item to the cache. Removes any pre-existing entries of the same key from the linked * list and adds this one first. * <p> * @param ce The cache element, or entry wrapper * @return MemoryElementDescriptor the new node * @throws IOException */ @Override protected MemoryElementDescriptor<K, V> adjustListForUpdate( ICacheElement<K, V> ce ) throws IOException { return addFirst( ce ); }
CompositeCache<String, String> cache = cacheMgr.getCache( region ); LRUMemoryCache<String, String> lru = new LRUMemoryCache<String, String>(); lru.initialize( cache ); lru.update( ice ); assertNull( "Should not have " + i + ":key", lru.get( i + ":key" ) ); String value = lru.get( i + ":key" ).getVal(); assertEquals( region + " data " + i, value ); Map<String, ICacheElement<String, String>> elements = lru.getMultiple( keys ); for ( int i = 0; i < 100; i++ ) lru.remove( i + ":key" ); assertNull( "Removed key should be null: " + i + ":key", lru.get( i + ":key" ) );