org.simpleds.cache
Class NullCacheManagerImpl

java.lang.Object
  extended by org.simpleds.cache.NullCacheManagerImpl
All Implemented Interfaces:
CacheManager

public class NullCacheManagerImpl
extends java.lang.Object
implements CacheManager

A non-caching CacheManager implementation. Using this class will effectively disable caching.


Field Summary
 
Fields inherited from interface org.simpleds.cache.CacheManager
MEMCACHE_NAMESPACE
 
Constructor Summary
NullCacheManagerImpl()
           
 
Method Summary
 void delete(java.util.Collection<? extends java.io.Serializable> keys)
          Delete contents from the cache
 void delete(com.google.appengine.api.datastore.Key key)
          Remove an entity from the cache
<T> T
get(com.google.appengine.api.datastore.Key key, ClassMetadata metadata)
          Check the level 1 and level 2 cache for the required value.
 java.util.Map<com.google.appengine.api.datastore.Key,java.lang.Object> get(com.google.common.collect.Multimap<ClassMetadata,com.google.appengine.api.datastore.Key> keys)
          Retrieve a set of entities from the cache
<T> T
get(java.lang.String key)
          Return the cached query data, if available
 void put(com.google.common.collect.ListMultimap<ClassMetadata,java.lang.Object> javaObjects, com.google.common.collect.ListMultimap<ClassMetadata,com.google.appengine.api.datastore.Entity> dsEntities)
          Put a collection of java objects in the cache
 void put(java.lang.Object instance, com.google.appengine.api.datastore.Entity entity, ClassMetadata metadata)
          Put an instance in the cache
 void put(java.lang.String cacheKey, java.lang.Object value, int seconds)
          Store query data into the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullCacheManagerImpl

public NullCacheManagerImpl()
Method Detail

delete

public void delete(com.google.appengine.api.datastore.Key key)
Description copied from interface: CacheManager
Remove an entity from the cache

Specified by:
delete in interface CacheManager
Parameters:
key - the key to remove

get

public <T> T get(com.google.appengine.api.datastore.Key key,
                 ClassMetadata metadata)
Description copied from interface: CacheManager
Check the level 1 and level 2 cache for the required value. If the value is found in Level 1 cache, it is returned as is. Otherwise, the Level 2 cache will be queried for the value. If found, the value will be injected into Level 1 and returned. If the value is not found in Level 1 or Level2, this method will return null.

Specified by:
get in interface CacheManager
Parameters:
key - the key of the persistent entity to return
Returns:
the cached value, or null if not found.

put

public void put(java.lang.Object instance,
                com.google.appengine.api.datastore.Entity entity,
                ClassMetadata metadata)
Description copied from interface: CacheManager
Put an instance in the cache

Specified by:
put in interface CacheManager
Parameters:
instance - the java object
entity - the datastore-equivalent Entity instance
metadata - the ClassMetadata instance for this entity

delete

public void delete(java.util.Collection<? extends java.io.Serializable> keys)
Description copied from interface: CacheManager
Delete contents from the cache

Specified by:
delete in interface CacheManager
Parameters:
keys - the keys to remove

get

public <T> T get(java.lang.String key)
Description copied from interface: CacheManager
Return the cached query data, if available

Specified by:
get in interface CacheManager
Parameters:
key - the key to retrieve
Returns:
the cached query data, null if not cached

put

public void put(java.lang.String cacheKey,
                java.lang.Object value,
                int seconds)
Description copied from interface: CacheManager
Store query data into the cache

Specified by:
put in interface CacheManager
Parameters:
cacheKey - the key of the query
value - the value to store
seconds - the number of seconds to store in the cache, 0 to use only the Level 1 cache

get

public java.util.Map<com.google.appengine.api.datastore.Key,java.lang.Object> get(com.google.common.collect.Multimap<ClassMetadata,com.google.appengine.api.datastore.Key> keys)
Description copied from interface: CacheManager
Retrieve a set of entities from the cache

Specified by:
get in interface CacheManager
Parameters:
keys - the keys to retrieve from the cache
Returns:
a Map of retrieved persistent entities.

put

public void put(com.google.common.collect.ListMultimap<ClassMetadata,java.lang.Object> javaObjects,
                com.google.common.collect.ListMultimap<ClassMetadata,com.google.appengine.api.datastore.Entity> dsEntities)
Description copied from interface: CacheManager
Put a collection of java objects in the cache

Specified by:
put in interface CacheManager
Parameters:
javaObjects - the persistent objects to put into the Level 1 cache
dsEntities - the list of entities to put into the Level 2 cache