Ejemplo n.º 1
0
 @Test
 public void testPutExpiration() {
   unwrap(service.put("key", "value", Expiration.byDeltaMillis(1000)));
   assertTrue(unwrap(service.contains("key")));
   sync();
   assertFalse(unwrap(service.contains("key")));
 }
Ejemplo n.º 2
0
 public void enableRelevanceForSector(long sectorIndex) {
   memcacheService.put(
       MC_KEY_SECTOR_RELEVANCE_PREFIX + sectorIndex,
       true,
       Expiration.byDeltaMillis(SECTOR_RELEVANCE_EXPIRATION_MILLIS),
       MemcacheService.SetPolicy.SET_ALWAYS);
 }
Ejemplo n.º 3
0
  @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")));
  }