Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.modama.tools
Class Cache  view Cache download Cache.java

java.lang.Object
  extended byorg.modama.tools.Cache

public class Cache
extends java.lang.Object

an abstract base clase that hase a static create method where an object is created from a given object, the new created object is cached in a hashmap using the hashcode of the fiven object as key


Nested Class Summary
static class Cache.CacheElement
          a element in the cache with the time of last use and creation
 
Field Summary
protected static java.util.HashMap cach
          a hashmap where the hashcode of the originsl image is the key for the thumbnail
protected static int CLEANUP
          every this value times the create method is used old elements are removed from the cache
protected static int cnt
          a counter that is incremented each time a thumbnail is requested
protected static long OLDERTHEN
          elements older than 10 minutes are removes
 
Constructor Summary
Cache()
           
 
Method Summary
static void add(java.lang.Object key, java.lang.Object value)
          adds a key value pair to the cache
static void clearCache()
          clears the complete cache
static void clearCache(long olderthen)
          clears all elements older the olderthen
static void clearCache(java.lang.Object key)
          clears the cache for the given object
protected static void create()
          call this in your create method, it runs the cleanup
static java.util.List getCached(java.lang.Object key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEANUP

protected static final int CLEANUP
every this value times the create method is used old elements are removed from the cache

See Also:
Constant Field Values

OLDERTHEN

protected static final long OLDERTHEN
elements older than 10 minutes are removes

See Also:
Constant Field Values

cach

protected static java.util.HashMap cach
a hashmap where the hashcode of the originsl image is the key for the thumbnail


cnt

protected static int cnt
a counter that is incremented each time a thumbnail is requested

Constructor Detail

Cache

public Cache()
Method Detail

clearCache

public static void clearCache()
clears the complete cache


clearCache

public static void clearCache(java.lang.Object key)
clears the cache for the given object


clearCache

public static void clearCache(long olderthen)
clears all elements older the olderthen


create

protected static void create()
call this in your create method, it runs the cleanup


add

public static void add(java.lang.Object key,
                       java.lang.Object value)
adds a key value pair to the cache


getCached

public static java.util.List getCached(java.lang.Object key)