org.apache.http.impl.client.cache.memcached

## 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 of `MemcachedCacheEntry`. This implementation simply uses Java serialization to serialize the storage key followed by the `HttpCacheEntry` into a byte array.

### Constructor Summary

Constructors
Constructor and Description
`MemcachedCacheEntryImpl()`
`MemcachedCacheEntryImpl(String key, HttpCacheEntry httpCacheEntry)`

### Method Summary

Methods
`HttpCacheEntry` `getHttpCacheEntry()` Returns the `HttpCacheEntry` associated with this entry.
`String` `getStorageKey()` Returns the storage key associated with this entry.
`void` `set(byte[] bytes)` Given a serialized representation of a `MemcachedCacheEntry`, attempt to reconstitute the storage key and `HttpCacheEntry` represented therein.
`byte[]` `toByteArray()` Returns a serialized representation of the current cache entry.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 interface `MemcachedCacheEntry`

#### getStorageKey

    public String getStorageKey()

Description copied from interface: `MemcachedCacheEntry`
Returns the storage key associated with this entry. May return `null` if this is an "unset" instance waiting to be `MemcachedCacheEntry.set(byte[])` with a serialized representation.

Specified by:
  `getStorageKey` in interface `MemcachedCacheEntry`

#### getHttpCacheEntry

    public HttpCacheEntry getHttpCacheEntry()

Description copied from interface: `MemcachedCacheEntry`
Returns the `HttpCacheEntry` associated with this entry. May return `null` if this is an "unset" instance waiting to be `MemcachedCacheEntry.set(byte[])` with a serialized representation.

Specified by:
  `getHttpCacheEntry` in interface `MemcachedCacheEntry`

#### set

    public void set(byte[] bytes)

Description copied from interface: `MemcachedCacheEntry`
Given a serialized representation of a `MemcachedCacheEntry`, attempt to reconstitute the storage key and `HttpCacheEntry` represented therein. After a successful call to this method, this object should return updated (as appropriate) values for `MemcachedCacheEntry.getStorageKey()` and `MemcachedCacheEntry.getHttpCacheEntry()`. This should be viewed as an atomic operation on the `MemcachedCacheEntry`.

Specified by:
  `set` in interface `MemcachedCacheEntry`
Parameters:
  `bytes` - serialized representation