Class MemcachedCacheEntryImpl
- java.lang.Object
-
- org.apache.http.impl.client.cache.memcached.MemcachedCacheEntryImpl
-
- All Implemented Interfaces:
MemcachedCacheEntry
public class MemcachedCacheEntryImpl extends java.lang.Object implements MemcachedCacheEntry
Default implementation ofMemcachedCacheEntry. This implementation simply uses Java serialization to serialize the storage key followed by theHttpCacheEntryinto a byte array.
-
-
Constructor Summary
Constructors Constructor Description MemcachedCacheEntryImpl()MemcachedCacheEntryImpl(java.lang.String key, HttpCacheEntry httpCacheEntry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpCacheEntrygetHttpCacheEntry()Returns theHttpCacheEntryassociated with this entry.java.lang.StringgetStorageKey()Returns the storage key associated with this entry.voidset(byte[] bytes)Given a serialized representation of aMemcachedCacheEntry, attempt to reconstitute the storage key andHttpCacheEntryrepresented therein.byte[]toByteArray()Returns a serialized representation of the current cache entry.
-
-
-
Constructor Detail
-
MemcachedCacheEntryImpl
public MemcachedCacheEntryImpl(java.lang.String key, HttpCacheEntry httpCacheEntry)
-
MemcachedCacheEntryImpl
public MemcachedCacheEntryImpl()
-
-
Method Detail
-
toByteArray
public byte[] toByteArray()
Description copied from interface:MemcachedCacheEntryReturns a serialized representation of the current cache entry.- Specified by:
toByteArrayin interfaceMemcachedCacheEntry
-
getStorageKey
public java.lang.String getStorageKey()
Description copied from interface:MemcachedCacheEntryReturns the storage key associated with this entry. May returnnullif this is an "unset" instance waiting to beMemcachedCacheEntry.set(byte[])with a serialized representation.- Specified by:
getStorageKeyin interfaceMemcachedCacheEntry
-
getHttpCacheEntry
public HttpCacheEntry getHttpCacheEntry()
Description copied from interface:MemcachedCacheEntryReturns theHttpCacheEntryassociated with this entry. May returnnullif this is an "unset" instance waiting to beMemcachedCacheEntry.set(byte[])with a serialized representation.- Specified by:
getHttpCacheEntryin interfaceMemcachedCacheEntry
-
set
public void set(byte[] bytes)
Description copied from interface:MemcachedCacheEntryGiven a serialized representation of aMemcachedCacheEntry, attempt to reconstitute the storage key andHttpCacheEntryrepresented 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:
setin interfaceMemcachedCacheEntry- Parameters:
bytes- serialized representation
-
-