public class GuavaMemcachedDataStore extends Object implements org.apache.wicket.pageStore.IDataStore
IDataStore that stores the pages' bytes in Memcached.
It uses Google Guava's Cache
as a Map with eviction functionality by last access time.
To use it the application has to add: com.google.guava:guava:10+ as dependency in
the classpath.
A useful read about the way Memcached works can be found
here.| Constructor and Description |
|---|
GuavaMemcachedDataStore(IMemcachedSettings settings)
Constructor.
|
GuavaMemcachedDataStore(net.spy.memcached.MemcachedClient client,
IMemcachedSettings settings)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeAsynchronous() |
static net.spy.memcached.MemcachedClient |
createClient(IMemcachedSettings settings)
Creates MemcachedClient with the provided hostname and port
in the settings
|
void |
destroy() |
byte[] |
getData(String sessionId,
int pageId) |
boolean |
isReplicated() |
void |
removeData(String sessionId) |
void |
removeData(String sessionId,
int pageId) |
void |
storeData(String sessionId,
int pageId,
byte[] data) |
public GuavaMemcachedDataStore(IMemcachedSettings settings) throws IOException
settings - The configuration for the clientIOException - when cannot connect to any of the provided
in IMemcachedSettings Memcached serverspublic GuavaMemcachedDataStore(net.spy.memcached.MemcachedClient client,
IMemcachedSettings settings)
client - The connection to Memcachedsettings - The configuration for the clientpublic static net.spy.memcached.MemcachedClient createClient(IMemcachedSettings settings) throws IOException
settings - The configuration for the clientIOException - when cannot connect to any of the provided Memcached serverspublic byte[] getData(String sessionId, int pageId)
getData in interface org.apache.wicket.pageStore.IDataStorepublic void removeData(String sessionId, int pageId)
removeData in interface org.apache.wicket.pageStore.IDataStorepublic void removeData(String sessionId)
removeData in interface org.apache.wicket.pageStore.IDataStorepublic void storeData(String sessionId, int pageId, byte[] data)
storeData in interface org.apache.wicket.pageStore.IDataStorepublic void destroy()
destroy in interface org.apache.wicket.pageStore.IDataStorepublic boolean isReplicated()
isReplicated in interface org.apache.wicket.pageStore.IDataStorepublic boolean canBeAsynchronous()
canBeAsynchronous in interface org.apache.wicket.pageStore.IDataStoreCopyright © 2015. All rights reserved.