org.tbee.cache.simple
Class LifespanCache

java.lang.Object
  extended by org.tbee.cache.simple.LifespanCache
All Implemented Interfaces:
Map, Cache

public class LifespanCache
extends Object
implements Cache

This cache holds items only for a specified number of seconds accessing the item does NOT restart the counter (see TimeoutCache)

Version:
$Revision: 1.4 $
Author:
$Author: tom $

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static char MODE_SOFT
           
static char MODE_STRONG
           
static char MODE_WEAK
           
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
LifespanCache()
          This constructor uses a life span specified in as a system property, or a default value (60 seconds) if the property is not present.
LifespanCache(char pMode)
          This constructor uses a life span specified in as a system property, or a default value (60 seconds) if the property is not present.
LifespanCache(char pMode, int pLifespan)
          The life span in milleseconds
LifespanCache(int pLifespan)
          The life span in milleseconds
 
Method Summary
 void addAssociation(Object association)
           
 void addCacheListener(CacheListener pCacheListener)
          A cache listener listens to both finalize and remove events
 void clear()
           
 Object clone()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 Object get(Object key)
           
 Vector getAssociations()
           
 String getName()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
           
 void removeCacheListener(CacheListener pCacheListener)
           
 void removeValue(Object value)
           
 void setName(String pName)
           
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.tbee.cache.simple.Cache
addAssociation, getName, setName
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

MODE_STRONG

public static char MODE_STRONG

MODE_SOFT

public static char MODE_SOFT

MODE_WEAK

public static char MODE_WEAK
Constructor Detail

LifespanCache

public LifespanCache()
This constructor uses a life span specified in as a system property, or a default value (60 seconds) if the property is not present.


LifespanCache

public LifespanCache(char pMode)
This constructor uses a life span specified in as a system property, or a default value (60 seconds) if the property is not present.


LifespanCache

public LifespanCache(char pMode,
                     int pLifespan)
The life span in milleseconds


LifespanCache

public LifespanCache(int pLifespan)
The life span in milleseconds

Method Detail

addCacheListener

public void addCacheListener(CacheListener pCacheListener)
A cache listener listens to both finalize and remove events

Specified by:
addCacheListener in interface Cache

removeCacheListener

public void removeCacheListener(CacheListener pCacheListener)
Specified by:
removeCacheListener in interface Cache

clear

public void clear()
Specified by:
clear in interface Map

clone

public Object clone()
Overrides:
clone in class Object

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

removeValue

public void removeValue(Object value)
Specified by:
removeValue in interface Cache

size

public int size()
Specified by:
size in interface Map

toString

public String toString()
Overrides:
toString in class Object

values

public Collection values()
Specified by:
values in interface Map

addAssociation

public void addAssociation(Object association)

getAssociations

public Vector getAssociations()

getName

public String getName()

setName

public void setName(String pName)


Copyright © 2010 KnowledgePlaza. All Rights Reserved.