@Test public void invalidate() { cache.put("a", "b"); cache.invalidate("a"); verify(indexHandler).add("a", "b"); verify(indexHandler).remove("a", "b"); assertEquals(cache.get("a"), null); }
public V invalidate(K key) { writeLock(key); try { final Pointer pointer = pointerMap.get(key); if (pointer != null) { final byte[] payload = bufferStore.remove(pointer); pointerMap.remove(key); final V value = serializer.deserialize(payload); indexHandler.remove(key, value); return value; } } finally { writeUnlock(key); } return null; }
OffHeapCache extends AbstractSearchableCache<K, V> { public V invalidate(K key) { writeLock(key); try { final Pointer pointer = pointerMap.get(key); if (pointer != null) { final byte[] payload = bufferStore.remove(pointer); pointerMap.remove(key); final V value = serializer.deserialize(payload); indexHandler.remove(key, value); return value; } } finally { writeUnlock(key); } return null; } }
OffHeapCache extends AbstractSearchableCache<K, V> { public V invalidate(K key) { writeLock(key); try { final Pointer pointer = pointerMap.get(key); if (pointer != null) { final byte[] payload = bufferStore.remove(pointer); pointerMap.remove(key); final V value = serializer.deserialize(payload); indexHandler.remove(key, value); return value; } } finally { writeUnlock(key); } return null; } OffHeapCache(final String name, final CacheLoader<K, V> cacheLoader,
      final EvictionListener<K, V> evictionListener,
      final IndexHandler<K, V> indexHandler, final OffHeapByteBufferStore byteBufferStore,
      final Serializer<V> serializer,
      final long bufferCleanerPeriod, final float bufferCleanerThreshold,
      final int concurrencyLevel,
      final long evictionPeriod); }
OffHeapCache extends AbstractSearchableCache<K, V> { public V invalidate(K key) { writeLock(key); try { final Pointer pointer = pointerMap.get(key); if (pointer != null) { final byte[] payload = bufferStore.remove(pointer); pointerMap.remove(key); final V value = serializer.deserialize(payload); indexHandler.remove(key, value); return value; } } finally { writeUnlock(key); } return null; } OffHeapCache(final String name, final CacheLoader<K, V> cacheLoader,
      final EvictionListener<K, V> evictionListener,
      final IndexHandler<K, V> indexHandler, final OffHeapByteBufferStore byteBufferStore,
      final Serializer<V> serializer,
      final long bufferCleanerPeriod, final float bufferCleanerThreshold,
      final int concurrencyLevel,
      final long evictionPeriod); void put(K key, V value); @Override void put(final K key, final V value, final TimeUnit timeUnit, final long duration); V get(K key); V invalidate(K key); boolean contains(K key); void clear(); @Override long size(); @Override CacheStats stats(); }
OffHeapCache extends AbstractSearchableCache<K, V> { public V invalidate(K key) { writeLock(key); try { final Pointer pointer = pointerMap.get(key); if (pointer != null) { final byte[] payload = bufferStore.remove(pointer); pointerMap.remove(key); final V value = serializer.deserialize(payload); indexHandler.remove(key, value); return value; } } finally { writeUnlock(key); } return null; } OffHeapCache(final String name, final CacheLoader<K, V> cacheLoader,
      final EvictionListener<K, V> evictionListener,
      final IndexHandler<K, V> indexHandler, final OffHeapByteBufferStore byteBufferStore,
      final Serializer<V> serializer,
      final long bufferCleanerPeriod, final float bufferCleanerThreshold,
      final int concurrencyLevel,
      final long evictionPeriod); void put(K key, V value); @Override void put(final K key, final V value, final TimeUnit timeUnit, final long duration); V get(K key); V invalidate(K key); boolean contains(K key); void clear(); @Override long size(); @Override CacheStats stats(); static final long DEFAULT_BUFFER_CLEANER_PERIOD; static final long DEFAULT_EVICTION_PERIOD; static final float DEFAULT_BUFFER_CLEANER_THRESHOLD; static final int DEFAULT_CONCURRENCY_LEVEL; }