Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013

ch.elexis.data.cache
Class SoftCache<K>

java.lang.Object
  extended by ch.elexis.data.cache.SoftCache<K>
All Implemented Interfaces:
IPersistentObjectCache<K>

public class SoftCache<K>
extends java.lang.Object
implements IPersistentObjectCache<K>

A Cache with soft references and optional expiring items The cache keeps count on numbes of items that are added, removed or expired and can display its statistic


Nested Class Summary
 class SoftCache.CacheEntry
           
 
Field Summary
protected  java.util.Map<K,SoftCache.CacheEntry> cache
           
protected  long expired
           
protected  long hits
           
protected  long inserts
           
protected  Log log
           
protected  long misses
           
protected  long removed
           
 
Constructor Summary
SoftCache()
           
SoftCache(int num)
           
SoftCache(int num, float load)
           
 
Method Summary
 void clear()
           
 java.lang.Object get(K key)
          retrieve a previously inserted object
 void purge()
          Expire and remove all Objects (without removing the SoftReferences, to avoid ConcurrentModificationExceptions)
 void put(K key, java.lang.Object object, int timeToCacheInSeconds)
          Insert an Object that will stay until it is manually removed, or memory gets low, or at most for ICacheable#getCacheTime seconds
 void remove(K key)
           
 void reset()
          completely delete cache
 void stat()
          write statistics to log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected java.util.Map<K,SoftCache.CacheEntry> cache

hits

protected long hits

misses

protected long misses

removed

protected long removed

inserts

protected long inserts

expired

protected long expired

log

protected Log log
Constructor Detail

SoftCache

public SoftCache()

SoftCache

public SoftCache(int num,
                 float load)

SoftCache

public SoftCache(int num)
Method Detail

put

public void put(K key,
                java.lang.Object object,
                int timeToCacheInSeconds)
Description copied from interface: IPersistentObjectCache
Insert an Object that will stay until it is manually removed, or memory gets low, or at most for ICacheable#getCacheTime seconds

Specified by:
put in interface IPersistentObjectCache<K>

get

public java.lang.Object get(K key)
Description copied from interface: IPersistentObjectCache
retrieve a previously inserted object

Specified by:
get in interface IPersistentObjectCache<K>
Returns:
the object or null, if the object was expired or removed bei the garbage collector.

remove

public void remove(K key)
Specified by:
remove in interface IPersistentObjectCache<K>

clear

public void clear()
Specified by:
clear in interface IPersistentObjectCache<K>

stat

public void stat()
Description copied from interface: IPersistentObjectCache
write statistics to log

Specified by:
stat in interface IPersistentObjectCache<K>

purge

public void purge()
Description copied from interface: IPersistentObjectCache
Expire and remove all Objects (without removing the SoftReferences, to avoid ConcurrentModificationExceptions)

Specified by:
purge in interface IPersistentObjectCache<K>

reset

public void reset()
Description copied from interface: IPersistentObjectCache
completely delete cache

Specified by:
reset in interface IPersistentObjectCache<K>

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013