### Question:
GuavaCacheManager extends AbstractCacheManager { <K, V> void configureCacheBuilder( CompleteConfiguration<K, V> completeConfiguration, CacheBuilder<Object, Object> cacheBuilder ) { ExpiryPolicy expiryPolicy = completeConfiguration.getExpiryPolicyFactory().create(); Duration expiryForAccess = expiryPolicy.getExpiryForAccess(); if ( expiryForAccess != null && !expiryForAccess.isEternal() ) { cacheBuilder.expireAfterAccess( expiryForAccess.getDurationAmount(), expiryForAccess.getTimeUnit() ); } Duration expiryForUpdate = expiryPolicy.getExpiryForUpdate(); if ( expiryForUpdate != null && !expiryForUpdate.isEternal() ) { cacheBuilder.expireAfterWrite( expiryForUpdate.getDurationAmount(), expiryForUpdate.getTimeUnit() ); } }  @Override Cache<K, V> newCache( final String cacheName, final C configuration );  }### Answer:
@Test public void testExpiry() throws Exception { CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder(); MutableConfiguration<String, String> configuration = new MutableConfiguration<String, String>(); final AtomicInteger elapsedTime = new AtomicInteger( 0 ); cacheBuilder.ticker( new Ticker() { @Override public long read() { return TimeUnit.SECONDS.toNanos( elapsedTime.get() ); } } ); configuration.setExpiryPolicyFactory( TouchedExpiryPolicy.factoryOf( new Duration( TimeUnit.MINUTES, 1 ) ) ); cacheManager.configureCacheBuilder( configuration, cacheBuilder ); ConcurrentMap<String, String> cache = cacheBuilder.<String, String>build().asMap(); elapsedTime.set( 0 ); cache.put( "key", "value" ); elapsedTime.addAndGet( 45 ); assertThat( cache.replace( "key", "value", "new value" ), is( true ) ); elapsedTime.addAndGet( 45 ); assertThat( cache.get( "key" ), equalTo( "new value" ) ); elapsedTime.addAndGet( 45 ); assertThat( cache.get( "key" ), nullValue() ); }