Tuesday, November 29, 2011

Google App Engine-Memcache

Memory cache is used in web applications to speed up the performance by caching frequently used entities. Memcache may also be useful for caching temporary values, not backed up persistent store. The app can provide an expiration time when a value is stored. By default, the values get evicted due to memory pressure, and the least recently used get evicted first. Applications should put logic to retrieve data on cache misses.

e.g.

1>        Getting App Engine's Memory Cache Service

      private static MemcacheService keycache = 
      MemcacheServiceFactory.getMemcacheService(); 
 

2>    Deleting Cache

      keycache.delete(key);
 
3>    Search for an entity
 
      return (Entity) keycache.get(key); 
 
4>    Add to cache
 
      keycache.put(key, entity); 
 
 

 

No comments:

Post a Comment