de.mid.innovator.net
Class InoTelegramCache<T extends InoTelegram>

java.lang.Object
  extended by de.mid.innovator.net.InoTelegramCache<T>
Direct Known Subclasses:
SrvDataTelegramCache

public class InoTelegramCache<T extends InoTelegram>
extends Object

A cache that manages entries based on the policy specified at creation time. The initial size of the cache can be configured through the "de.mid.innovator.api.cache.size" system property. The default size is 2048 entries.


Nested Class Summary
static class InoTelegramCache.CachePolicy
           
 
Constructor Summary
InoTelegramCache()
          Creates a cache with specific policy
 
Method Summary
 void clear()
           
 void disable()
           
 T get(T key)
          Queries the cache for the specific host.
 int getAccessCnt()
           
 int getHitCnt()
           
 InoTelegramCache<T> put(T send, T rcv)
          Adds an entry to the cache.
 void resetStatistics()
           
 void setPolicy(InoTelegramCache.CachePolicy policy)
          Change the cache policy and use this policy for the future use of the cache.
 int size()
           
 String stats()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InoTelegramCache

public InoTelegramCache()
Creates a cache with specific policy

Method Detail

clear

public void clear()

disable

public void disable()

get

public T get(T key)
Queries the cache for the specific host. If found, the CacheEntry is returned, otherwise null.


getAccessCnt

public int getAccessCnt()

getHitCnt

public int getHitCnt()

put

public InoTelegramCache<T> put(T send,
                               T rcv)
Adds an entry to the cache. The entry is not updated. exists.


resetStatistics

public void resetStatistics()

setPolicy

public void setPolicy(InoTelegramCache.CachePolicy policy)
Change the cache policy and use this policy for the future use of the cache. Hence the new policy is valid for old and new cache entry. Hence, e.g. setting the policy to DISABLE will clear the cache.

Parameters:
policy - New policy to use for cache.

size

public int size()

stats

public String stats()

toString

public String toString()
Overrides:
toString in class Object