| java.lang.Object sunlabs.brazil.session.SessionManager sunlabs.brazil.session.CacheManager
All known Subclasses: sunlabs.brazil.session.SerializableCacheManager, sunlabs.brazil.session.PropertiesCacheManager,
CacheManager | public class CacheManager extends SessionManager implements Handler(Code) | | This SessionManager associates an object with a Session ID
to give Handlers the ability to maintain state that lasts for the
duration of a session instead of just for the duration of a request.
It should be installed as a handler, whoses init method will replace
the default session manager.
This version maintains a pool of hashtables. Once they all
fill up - one of them gets tossed, causing any session info in it
to be lost. It uses a simplified approximate LRU scheme.
The default session manager doesn't loose any session information,
but grows the heap without bound as the number of sessions increase.
properties:
- tables
- The number of Hashtables in the pool (defaults to 6)
- size
- The max number of entries in each table (defaults to 1000).
author: Stephen Uhler (stephen.uhler@sun.com) version: %V% CacheManager.java |
Inner Class :static class ScoredHashtable extends Hashtable | |
Method Summary | |
protected void | flush() The active hashtable is too big, find the hashtable
with the worst Score, clear it, and set it as the active table. | protected Object | get(Object key) Find the item in a hashtable. | public Object | getSessionObject(Object session, Object ident, Class type) Store entry in a hashtable. | public boolean | init(Server server, String prefix) Install this class as the session manager. | protected void | put(Object key, Object value) Puts the item in the active hashtable. | public boolean | respond(Request request) |
maxElements | int maxElements(Code) | | |
pool | ScoredHashtable[] pool(Code) | | |
flush | protected void flush()(Code) | | The active hashtable is too big, find the hashtable
with the worst Score, clear it, and set it as the active table.
|
get | protected Object get(Object key)(Code) | | Find the item in a hashtable.
Looks in the active hashtable first, then searches the
rest in order.
|
getSessionObject | public Object getSessionObject(Object session, Object ident, Class type)(Code) | | Store entry in a hashtable. Use the concatenation of the
hashcodes for the key.
|
init | public boolean init(Server server, String prefix)(Code) | | Install this class as the session manager.
Get the number of tables, and the max size per table.
|
put | protected void put(Object key, Object value)(Code) | | Puts the item in the active hashtable.
If there is not enough room, switch active tables first.
|
respond | public boolean respond(Request request)(Code) | | Don't handle any URL requests (yet)
|
|
|