Class MemcachedCacheEntryImpl
java.lang.Object
org.apache.http.impl.client.cache.memcached.MemcachedCacheEntryImpl
- All Implemented Interfaces:
MemcachedCacheEntry
Default implementation of
MemcachedCacheEntry
. This implementation
simply uses Java serialization to serialize the storage key followed by
the HttpCacheEntry
into a byte array.-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
MemcachedCacheEntryImpl
-
MemcachedCacheEntryImpl
public MemcachedCacheEntryImpl()
-
-
Method Details
-
toByteArray
public byte[] toByteArray()Description copied from interface:MemcachedCacheEntry
Returns a serialized representation of the current cache entry.- Specified by:
toByteArray
in interfaceMemcachedCacheEntry
-
getStorageKey
Description copied from interface:MemcachedCacheEntry
Returns the storage key associated with this entry. May returnnull
if this is an "unset" instance waiting to beMemcachedCacheEntry.set(byte[])
with a serialized representation.- Specified by:
getStorageKey
in interfaceMemcachedCacheEntry
-
getHttpCacheEntry
Description copied from interface:MemcachedCacheEntry
Returns theHttpCacheEntry
associated with this entry. May returnnull
if this is an "unset" instance waiting to beMemcachedCacheEntry.set(byte[])
with a serialized representation.- Specified by:
getHttpCacheEntry
in interfaceMemcachedCacheEntry
-
set
public void set(byte[] bytes) Description copied from interface:MemcachedCacheEntry
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 forMemcachedCacheEntry.getStorageKey()
andMemcachedCacheEntry.getHttpCacheEntry()
. This should be viewed as an atomic operation on theMemcachedCacheEntry
.- Specified by:
set
in interfaceMemcachedCacheEntry
- Parameters:
bytes
- serialized representation
-