Interface MemcachedCacheEntry
- All Known Implementing Classes:
MemcachedCacheEntryImpl
public interface MemcachedCacheEntry
Provides for serialization and deserialization of higher-level
HttpCacheEntry
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 as MemcachedCacheEntryFactory
.-
Method Summary
Modifier and TypeMethodDescriptionReturns theHttpCacheEntry
associated with this entry.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[]
Returns a serialized representation of the current cache entry.
-
Method Details
-
toByteArray
byte[] toByteArray()Returns a serialized representation of the current cache entry. -
getStorageKey
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.
-