public class HttpSessionDataStore extends Object implements IDataStore
IDataStore
which stores the pages in the HttpSession
. Uses
IDataStoreEvictionStrategy
to keep the memory footprint reasonable.
Usage:
MyApp#init() { setPageManagerProvider(new DefaultPageManagerProvider(this) { protected IDataStore newDataStore() { return new HttpSessionDataStore(pageManagerContext, new PageNumberEvictionStrategy(20)); } } }
Constructor and Description |
---|
HttpSessionDataStore(IPageManagerContext pageManagerContext,
IDataStoreEvictionStrategy evictionStrategy)
Construct.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canBeAsynchronous() |
void |
destroy()
Properly close the data store and possibly open resource handles
|
byte[] |
getData(String sessionId,
int pageId)
Get data associated with the session id and page id.
|
boolean |
isReplicated() |
void |
removeData(String sessionId)
Remove all page data for the session id
|
void |
removeData(String sessionId,
int pageId)
Remove all persisted data related to the session id and page id
|
void |
storeData(String sessionId,
int pageId,
byte[] pageAsBytes)
Store the page data
|
public HttpSessionDataStore(IPageManagerContext pageManagerContext, IDataStoreEvictionStrategy evictionStrategy)
pageManagerContext
- evictionStrategy
- public byte[] getData(String sessionId, int pageId)
IDataStore
getData
in interface IDataStore
sessionId
- Ignored. Only pages from the current http session can be readpageId
- Page IDIDataStore.getData(java.lang.String, int)
public void removeData(String sessionId, int pageId)
IDataStore
removeData
in interface IDataStore
sessionId
- Session IDpageId
- Page IDpublic void removeData(String sessionId)
IDataStore
removeData
in interface IDataStore
sessionId
- Session IDpublic void storeData(String sessionId, int pageId, byte[] pageAsBytes)
IDataStore
storeData
in interface IDataStore
sessionId
- Session IDpageId
- Page IDpageAsBytes
- Page datapublic void destroy()
IDataStore
destroy
in interface IDataStore
public boolean isReplicated()
isReplicated
in interface IDataStore
public final boolean canBeAsynchronous()
canBeAsynchronous
in interface IDataStore
AsynchronousDataStore
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.