Class SpyMemcacheService
- java.lang.Object
-
- com.googlecode.objectify.cache.spymemcached.SpyMemcacheService
-
- All Implemented Interfaces:
MemcacheService
public class SpyMemcacheService extends Object implements MemcacheService
Among the issues this impl needs to be concerned with is that memcached doesn't store nulls. We have to replace it with something (in our case, an empty string).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.googlecode.objectify.cache.MemcacheService
MemcacheService.CasPut
-
-
Constructor Summary
Constructors Constructor Description SpyMemcacheService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAll(Collection<String> keys)
Object
get(String key)
Map<String,Object>
getAll(Collection<String> keys)
Map<String,IdentifiableValue>
getIdentifiables(Collection<String> keys)
For cache implementations that don't handle a cold cache for a key (eg memcached), the implementation of this method needs to hide that behavior (ie, bootstrap an initial value so we can get a CAS value).void
put(String key, Object value)
Values can be nullvoid
putAll(Map<String,Object> values)
Values can be nullSet<String>
putIfUntouched(Map<String,MemcacheService.CasPut> values)
Values can be null
-
-
-
Method Detail
-
get
public Object get(String key)
- Specified by:
get
in interfaceMemcacheService
- Returns:
- the value in memcache for this, or null if there was nothing there
-
getIdentifiables
public Map<String,IdentifiableValue> getIdentifiables(Collection<String> keys)
Description copied from interface:MemcacheService
For cache implementations that don't handle a cold cache for a key (eg memcached), the implementation of this method needs to hide that behavior (ie, bootstrap an initial value so we can get a CAS value). That doesn't mean the result will always be a value; the bootstrap may fail (for whatever reason) and the resulting map value for a key will be null.- Specified by:
getIdentifiables
in interfaceMemcacheService
-
getAll
public Map<String,Object> getAll(Collection<String> keys)
- Specified by:
getAll
in interfaceMemcacheService
-
put
public void put(String key, Object value)
Description copied from interface:MemcacheService
Values can be null- Specified by:
put
in interfaceMemcacheService
-
putIfUntouched
public Set<String> putIfUntouched(Map<String,MemcacheService.CasPut> values)
Description copied from interface:MemcacheService
Values can be null- Specified by:
putIfUntouched
in interfaceMemcacheService
- Returns:
- a set of all the keys that succeeded
-
putAll
public void putAll(Map<String,Object> values)
Description copied from interface:MemcacheService
Values can be null- Specified by:
putAll
in interfaceMemcacheService
-
deleteAll
public void deleteAll(Collection<String> keys)
- Specified by:
deleteAll
in interfaceMemcacheService
-
-