|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.speedo.usercache.lib.UserCacheImpl
Is a basic UserCacheView implementation using WeakReference in order to not disturb the real cache of persistent object.
Field Summary | |
---|---|
protected boolean |
active
Indicates if the user cache is active |
static int |
DEFAULT_SIZE
|
protected java.lang.String[] |
fields
is the list of field name used for the cache index |
protected int |
id
The identifier of the user cache (light weight pattern) |
protected java.util.Map |
key2oid
Contains the association user key TO object identifier |
protected java.lang.String |
name
The name of the user cache |
protected java.util.Map |
oid2key
Contains the association object identifier TO user key |
Constructor Summary | |
---|---|
UserCacheImpl()
Allocates an user cache with the default size. |
|
UserCacheImpl(int size)
Allocates an user cache with a particular size. |
Method Summary | |
---|---|
java.lang.Object |
bind(java.lang.Object key,
java.lang.Object oid)
Adds an entry into user cache. |
int |
getId()
|
java.lang.String[] |
getIndexFieldNames()
|
java.lang.String |
getName()
|
boolean |
isActive()
|
java.lang.Object |
lookup(java.lang.Object key)
Look for an identifier of persistent instance from an user key |
void |
setActive(boolean a)
|
void |
setId(int _id)
|
void |
setIndexFieldNames(java.lang.String[] fns)
|
void |
setName(java.lang.String n)
|
java.lang.Object |
unbindFromKey(java.lang.Object key)
Forces the eviction of an entry from an user key |
java.lang.Object |
unbindFromOID(java.lang.Object oid)
Forces the eviction of an entry from an object identifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT_SIZE
protected java.util.Map key2oid
protected java.util.Map oid2key
protected java.lang.String name
protected int id
protected boolean active
protected java.lang.String[] fields
Constructor Detail |
public UserCacheImpl()
DEFAULT_SIZE
,
UserCacheImpl(int)
public UserCacheImpl(int size)
size
- is the size of the cache.Method Detail |
public java.lang.Object bind(java.lang.Object key, java.lang.Object oid)
UserCache
bind
in interface UserCache
key
- is the user key the user of the persistent instance (not null)oid
- is the identifier of the persistent instance (not null)
public java.lang.Object unbindFromKey(java.lang.Object key)
UserCache
unbindFromKey
in interface UserCache
key
- is the user key of a persistent instance (not null)
public java.lang.Object unbindFromOID(java.lang.Object oid)
UserCache
unbindFromOID
in interface UserCache
oid
- is the identifier of a persistent instance (not null)
public java.lang.Object lookup(java.lang.Object key)
UserCache
lookup
in interface UserCache
key
- is the user key of the searched persistent instance (not null)
public int getId()
getId
in interface UserCache
public void setId(int _id)
public java.lang.String[] getIndexFieldNames()
getIndexFieldNames
in interface UserCache
public void setIndexFieldNames(java.lang.String[] fns)
public java.lang.String getName()
getName
in interface UserCache
public void setName(java.lang.String n)
public boolean isActive()
isActive
in interface UserCache
public void setActive(boolean a)
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |