@Test
 public void testFlushUpdatesAccessStats() throws CacheAccessException {
   final TestTimeSource timeSource = new TestTimeSource();
   final Expiry<Object, Object> expiry =
       Expirations.timeToIdleExpiration(new Duration(15L, TimeUnit.MILLISECONDS));
   final AbstractOffHeapStore<String, String> store = createAndInitStore(timeSource, expiry);
   try {
     final String key = "foo";
     final String value = "bar";
     store.put(key, value);
     final Store.ValueHolder<String> firstValueHolder = store.getAndFault(key);
     store.put(key, value);
     final Store.ValueHolder<String> secondValueHolder = store.getAndFault(key);
     timeSource.advanceTime(10);
     ((AbstractValueHolder) firstValueHolder)
         .accessed(timeSource.getTimeMillis(), expiry.getExpiryForAccess(key, value));
     timeSource.advanceTime(10);
     ((AbstractValueHolder) secondValueHolder)
         .accessed(timeSource.getTimeMillis(), expiry.getExpiryForAccess(key, value));
     assertThat(store.flush(key, new DelegatingValueHolder<String>(firstValueHolder)), is(false));
     assertThat(store.flush(key, new DelegatingValueHolder<String>(secondValueHolder)), is(true));
     timeSource.advanceTime(10); // this should NOT affect
     assertThat(
         store.getAndFault(key).lastAccessTime(TimeUnit.MILLISECONDS),
         is(secondValueHolder.creationTime(TimeUnit.MILLISECONDS) + 20));
   } finally {
     destroyStore(store);
   }
 }
 @Test
 public void testFlushUpdatesHits() throws CacheAccessException {
   final TestTimeSource timeSource = new TestTimeSource();
   final AbstractOffHeapStore<String, String> store =
       createAndInitStore(timeSource, Expirations.noExpiration());
   final String key = "foo1";
   final String value = "bar1";
   store.put(key, value);
   for (int i = 0; i < 5; i++) {
     final Store.ValueHolder<String> valueHolder = store.getAndFault(key);
     timeSource.advanceTime(1);
     ((AbstractValueHolder) valueHolder)
         .accessed(timeSource.getTimeMillis(), new Duration(1L, TimeUnit.MILLISECONDS));
     assertThat(store.flush(key, new DelegatingValueHolder<String>(valueHolder)), is(true));
   }
   assertThat(store.getAndFault(key).hits(), is(5l));
 }