public class GroupedCache
extends java.lang.Object
Constructor and Description |
---|
GroupedCache(java.lang.String name,
int capacity) |
GroupedCache(java.lang.String name,
int capacity,
int option,
int timeout,
int threshold) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.String key)
It only checks the existence of the object identified by the key,
no matter whether the object has expired or not.
|
java.lang.String[] |
disfragment(long currentTime)
It removes all expired objects, resets all sequence numbers and returns
an array of all expired keys that have been just removed.
|
boolean |
existsGroup(int id)
returns true if the group with the id exists
|
boolean |
existsGroup(java.lang.String name)
returns true if the group with the name exists
|
int |
expire(java.lang.String key,
long currentTime)
It expires the object and returns 0 if the ttl is larger than zero.
|
int |
expireGroup(int id,
long currentTime)
It expires all the object belonging to the group of id and returns
number of the objects expired.
|
protected void |
finalize() |
java.lang.Object |
get(java.lang.String key,
long currentTime)
It only returns the object of the key if it has not expired yet.
|
int |
getCapacity() |
long |
getCount(java.lang.String key)
returns the access count for the object referenced by the key.
|
int[] |
getMetaData(java.lang.String key)
It returns the metadata for the object referenced by the key no matter
whether the object is expired or not.
|
java.lang.String |
getName() |
long |
getTimestamp(java.lang.String key)
returns the timestamp for the object referenced by the key.
|
int |
getTTL(java.lang.String key)
returns the ttl for the object referenced by the key.
|
Browser |
groupBrowser()
returns a Browser for all group IDs in the natural order
|
int |
groupID(java.lang.String name) |
java.lang.String |
groupName(int id) |
int |
groupSize() |
int |
insert(java.lang.String key,
long timestamp,
int ttl,
int[] meta,
java.lang.String[] groups,
java.lang.Object obj)
It checks the existence of the key first.
|
int |
invalidateGroup(int id,
long currentTime)
It invalidates all the object belonging to the group of id and returns
number of the objects invalidated.
|
boolean |
isExpired(java.lang.String key,
long currentTime)
returns true if the object of the key has expired, or false otherwise.
|
java.util.Iterator |
keyIterator(int id)
returns an Iterator for all existing keys in the group with id or
null if the group id does not exist.
|
java.util.Set<java.lang.String> |
keySet()
returns a set for all existing keys of the entire cache
|
int |
size()
returns the total number of cached objects
|
java.lang.String[] |
sortedKeys()
returns the array of all the existing keys in the NATURAL order
no matter whether they have expired or not.
|
int |
touch(java.lang.String key,
long timestamp)
updates mtime of key if it has not expired.
|
int |
touch(java.lang.String key,
long timestamp,
long currentTime)
updates mtime of key with a given reference time for expiration.
|
int |
update(java.lang.String key,
long timestamp,
int ttl,
int[] meta,
java.lang.Object obj)
It checks the existence of the key first.
|
public GroupedCache(java.lang.String name, int capacity, int option, int timeout, int threshold)
public GroupedCache(java.lang.String name, int capacity)
public int insert(java.lang.String key, long timestamp, int ttl, int[] meta, java.lang.String[] groups, java.lang.Object obj)
public int update(java.lang.String key, long timestamp, int ttl, int[] meta, java.lang.Object obj)
public java.lang.Object get(java.lang.String key, long currentTime)
public int expire(java.lang.String key, long currentTime)
public int touch(java.lang.String key, long timestamp)
public int touch(java.lang.String key, long timestamp, long currentTime)
public int expireGroup(int id, long currentTime)
public int invalidateGroup(int id, long currentTime)
public boolean isExpired(java.lang.String key, long currentTime)
public boolean containsKey(java.lang.String key)
public int getTTL(java.lang.String key)
public long getTimestamp(java.lang.String key)
public long getCount(java.lang.String key)
public int[] getMetaData(java.lang.String key)
public int size()
public java.lang.String[] disfragment(long currentTime)
public java.lang.String[] sortedKeys()
public java.util.Set<java.lang.String> keySet()
public java.util.Iterator keyIterator(int id)
public Browser groupBrowser()
public boolean existsGroup(int id)
public boolean existsGroup(java.lang.String name)
public java.lang.String groupName(int id)
public int groupID(java.lang.String name)
public int groupSize()
public int getCapacity()
public java.lang.String getName()
public void clear()
protected void finalize()
finalize
in class java.lang.Object