@Test public void testPutExpiration() { unwrap(service.put("key", "value", Expiration.byDeltaMillis(1000))); assertTrue(unwrap(service.contains("key"))); sync(); assertFalse(unwrap(service.contains("key"))); }
public void enableRelevanceForSector(long sectorIndex) { memcacheService.put( MC_KEY_SECTOR_RELEVANCE_PREFIX + sectorIndex, true, Expiration.byDeltaMillis(SECTOR_RELEVANCE_EXPIRATION_MILLIS), MemcacheService.SetPolicy.SET_ALWAYS); }
@Test public void testPutAllExpiration() { HashMap<Object, Object> map = new HashMap<Object, Object>(); map.put("key1", "value1"); map.put("key2", "value2"); unwrap(service.putAll(map, Expiration.byDeltaMillis(1000))); assertTrue(unwrap(service.contains("key1"))); assertTrue(unwrap(service.contains("key2"))); sync(); assertFalse(unwrap(service.contains("key1"))); assertFalse(unwrap(service.contains("key2"))); }