|
|||||||||
| Home >> All >> org >> jdbf >> engine >> [ caching overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jdbf.engine.caching
Class CacheManager

java.lang.Objectorg.jdbf.engine.caching.CacheManager
- public class CacheManager
- extends java.lang.Object
| Field Summary | |
private static java.util.Hashtable |
cache
This is the HashMap that contains all objects in the cache. |
private static int |
cacheSize
This is the max capacity of the cache. |
private static int |
deletedCount
This is the count of objects deleted from the cache |
private static int |
getCount
This is the number of objects read from the cache. |
private static int |
maxUsage
This is the max usage of the cache |
private static int |
putCount
This is the number of objects put in the cache |
private static int |
sumDeleted
This is the sum of the frequency of the objects deleted from the cache |
private static int |
sumUsage
This is the sum of the usage of the cache |
private static int |
zeroDeleted
This is the number of objects deleted from the cache, with frequency 0 |
| Constructor Summary | |
CacheManager()
|
|
| Method Summary | |
static java.util.Hashtable |
getCache()
Returns a Hashtable with the contents of the cache. |
static Cacheable |
getCache(java.lang.Object identifier)
Gets an object from the cache. |
private static Cacheable |
getLFU()
Looks for the Least Frequently Used object and returns its reference. |
static void |
putCache(Cacheable object)
Adds a new Object to the cache. |
static boolean |
setSize(int newSize)
Sets the size of the cache. |
static void |
showStats()
Shows some statistics about the usage of the cache |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
cache
private static java.util.Hashtable cache
- This is the HashMap that contains all objects in the cache.
cacheSize
private static int cacheSize
- This is the max capacity of the cache.
If the number object stored in the cache is greater than this, one
object will be replaced using LFU (Least Frequently Used) algorithm.
putCount
private static int putCount
- This is the number of objects put in the cache
getCount
private static int getCount
- This is the number of objects read from the cache.
zeroDeleted
private static int zeroDeleted
- This is the number of objects deleted from the cache, with frequency 0
deletedCount
private static int deletedCount
- This is the count of objects deleted from the cache
sumDeleted
private static int sumDeleted
- This is the sum of the frequency of the objects deleted from the cache
maxUsage
private static int maxUsage
- This is the max usage of the cache
sumUsage
private static int sumUsage
- This is the sum of the usage of the cache
| Constructor Detail |
CacheManager
public CacheManager()
| Method Detail |
getLFU
private static Cacheable getLFU()
- Looks for the Least Frequently Used object and returns its reference.
Every time an object is read from the cache, it's frequency is incremented.
When a new object is going to be added to a full cache, LFU algorithm deletes
the object with least frequency in the cache.
If more than one object have the same frequency, and this is the least frequency
found, LFU algorithm deletes the oldest object.
putCache
public static void putCache(Cacheable object)
- Adds a new Object to the cache.
If the object was previously in the cache, the newer
object replaces the older one.
getCache
public static Cacheable getCache(java.lang.Object identifier)
- Gets an object from the cache.
getCache
public static java.util.Hashtable getCache()
- Returns a Hashtable with the contents of the cache.
setSize
public static boolean setSize(int newSize)
- Sets the size of the cache.
If the cache contains more objects than the new size lets it,
some objects are removed using LFU algorithm.
showStats
public static void showStats()
- Shows some statistics about the usage of the cache
|
|||||||||
| Home >> All >> org >> jdbf >> engine >> [ caching overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.jdbf.engine.caching.CacheManager