Interface MemcachedCacheEntry
-
- All Known Implementing Classes:
MemcachedCacheEntryImpl
public interface MemcachedCacheEntry
Provides for serialization and deserialization of higher-levelHttpCacheEntry
objects into byte arrays suitable for storage in memcached. Clients wishing to change the serialization mechanism from the provided defaults should implement this interface as well asMemcachedCacheEntryFactory
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpCacheEntry
getHttpCacheEntry()
Returns theHttpCacheEntry
associated with this entry.java.lang.String
getStorageKey()
Returns the storage key associated with this entry.void
set(byte[] bytes)
Given a serialized representation of aMemcachedCacheEntry
, attempt to reconstitute the storage key andHttpCacheEntry
represented therein.byte[]
toByteArray()
Returns a serialized representation of the current cache entry.
-
-
-
Method Detail
-
toByteArray
byte[] toByteArray()
Returns a serialized representation of the current cache entry.
-
getStorageKey
java.lang.String getStorageKey()
Returns the storage key associated with this entry. May returnnull
if this is an "unset" instance waiting to beset(byte[])
with a serialized representation.
-
getHttpCacheEntry
HttpCacheEntry getHttpCacheEntry()
Returns theHttpCacheEntry
associated with this entry. May returnnull
if this is an "unset" instance waiting to beset(byte[])
with a serialized representation.
-
set
void set(byte[] bytes)
Given a serialized representation of aMemcachedCacheEntry
, attempt to reconstitute the storage key andHttpCacheEntry
represented therein. After a successful call to this method, this object should return updated (as appropriate) values forgetStorageKey()
andgetHttpCacheEntry()
. This should be viewed as an atomic operation on theMemcachedCacheEntry
.- Parameters:
bytes
- serialized representation- Throws:
MemcachedSerializationException
- if deserialization fails. In this case, the prior values for {getStorageKey()
andgetHttpCacheEntry()
should remain unchanged.
-
-