Class MemcachedCacheEntryImpl
- java.lang.Object
-
- org.apache.http.impl.client.cache.memcached.MemcachedCacheEntryImpl
-
- All Implemented Interfaces:
MemcachedCacheEntry
public class MemcachedCacheEntryImpl extends Object implements MemcachedCacheEntry
Default implementation ofMemcachedCacheEntry
. This implementation simply uses Java serialization to serialize the storage key followed by theHttpCacheEntry
into a byte array.
-
-
Constructor Summary
Constructors Constructor Description MemcachedCacheEntryImpl()
MemcachedCacheEntryImpl(String key, HttpCacheEntry httpCacheEntry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpCacheEntry
getHttpCacheEntry()
Returns theHttpCacheEntry
associated with this entry.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.
-
-
-
Constructor Detail
-
MemcachedCacheEntryImpl
public MemcachedCacheEntryImpl(String key, HttpCacheEntry httpCacheEntry)
-
MemcachedCacheEntryImpl
public MemcachedCacheEntryImpl()
-
-
Method Detail
-
toByteArray
public byte[] toByteArray()
Description copied from interface:MemcachedCacheEntry
Returns a serialized representation of the current cache entry.- Specified by:
toByteArray
in interfaceMemcachedCacheEntry
-
getStorageKey
public String 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
public HttpCacheEntry 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
-
-