VersionedOffHeapCache implements SearchableCache<K, VersionedItem<V>> { public long size() { return offHeapCache.size(); } VersionedOffHeapCache(final String name, final Serializer<VersionedItem<V>> serializer,
      final OffHeapByteBufferStore byteBufferStore,
      final CacheLoader<K, VersionedItem<V>> cacheLoader,
      final EvictionListener<K, VersionedItem<V>> evictionListener,
      final IndexHandler<K, VersionedItem<V>> indexHandler,
      final long bufferCleanerPeriod, final float bufferCleanerThreshold,
      final int concurrencyLevel, final long evictionPeriod);  VersionedOffHeapCache(final String name, final OffHeapByteBufferStore byteBufferStore,
      final Serializer<V> serializer, final CacheLoader<K, V> cacheLoader,
      final EvictionListener<K, V> evictionListener, final IndexHandler<K, V> indexHandler,
      final long bufferCleanerPeriod, final float bufferCleanerThreshold,
      final int concurrencyLevel,
      final long evictionPeriod); void put(K key, VersionedItem<V> value); @Override void put(final K key, VersionedItem<V> value, final TimeUnit timeUnit,
      final long duration); VersionedItem<V> get(K key); VersionedItem<V> invalidate(K key); boolean contains(K key); void clear(); long size(); List<VersionedItem<V>> execute(Query query); String getName(); @Override CacheStats stats();  }
@Test public void size() throws InterruptedException { final int size = 5; for (int i = 0; i < 5; i++) { cache.put( "key|" + i, new SimpleItem(i +"")); } assertEquals(size, cache.size()); cache.clear(); assertEquals(0, cache.size()); }