Package org.directmemory

Examples of org.directmemory.CacheEntry


    }
  }
 
  public boolean remove(String key) {
    logger.debug("remove entry with key " + key);
    CacheEntry entry = entries.get(key);
    return lruQueue.remove(entry);
  }
View Full Code Here


    CacheEntry entry = entries.get(key);
    return lruQueue.remove(entry);
  }
 
  public CacheEntry get(String key) {
    CacheEntry entry = entries.get(key);
    if (restore(entry)) {
      lruQueue.remove(entry);
      lruQueue.add(entry);
      logger.debug("retrieve entry with key " + key);
      return entry;
View Full Code Here

    remove(entry);
    storage.store(entry);
  }
 
  public void moveEntryTo(String key, Storage storage) {
    CacheEntry entry = get(key);
    moveEntryTo(entry, storage);
  }
View Full Code Here

    lruQueue.remove(entry);
    storage.store(entry);
  }
 
  public void moveButKeepTrackOfEntryTo(String key, Storage storage) {
    CacheEntry entry = get(key);
    moveButKeepTrackOfEntryTo(entry, storage);
  }
View Full Code Here

   
    int memoryUsed = 0;
    int count = 0;
   
    while (memoryUsed <= cacheSize - objectSize) {
      CacheEntry entry = new CacheEntry();
      entry.key = "key"+(count++);
      DummyPojo obj = new DummyPojo(entry.key, objectSize);
     
      Split serSplit = serializeMon.start();
      byte[] src = serialize(obj);
View Full Code Here

    cache.put("test1", new DummyPojo("test1", 1024));
    cache.put("test2", new DummyPojo("test2", 1024));
    cache.put("test3", new DummyPojo("test3", 1024));
    cache.put("test4", new DummyPojo("test4", 1024));
    cache.put("test5", new DummyPojo("test5", 1024));
    CacheEntry last = cache.removeLast();
    // should be the first one inserted
    assertEquals("test1", last.key);
    cache.get("test2");
    // accessing an element should put it back at the beginning of the list
    last = cache.removeLast();
View Full Code Here

 
  @Test
  public void remove() {
    CacheStore cache = new CacheStore(-1, 1 * 1024 * 1024, 1);
    cache.put("test1", new DummyPojo("test1", 1024));
    CacheEntry entry = cache.remove("test1");
    assertEquals("test1", entry.key);
    entry = cache.getEntry("test1");
    assertNull(entry);
    cache.reset();
  }
View Full Code Here

TOP

Related Classes of org.directmemory.CacheEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.