org.jmage.cache
Class LRUDiskCache

java.lang.Object
  extended by org.jmage.cache.LRUDiskCache
All Implemented Interfaces:
Cache

public class LRUDiskCache
extends java.lang.Object
implements Cache

A simple disk cache.


Nested Class Summary
static class LRUDiskCache.CacheFilter
           
static class LRUDiskCache.ModificationComparator
           
 
Field Summary
protected  java.io.File cacheDir
           
protected static LRUDiskCache.CacheFilter cacheFilter
           
protected  int capacity
           
protected static org.apache.log4j.Logger log
           
protected static LRUDiskCache.ModificationComparator modificationComparator
           
 
Constructor Summary
LRUDiskCache()
           
 
Method Summary
 void destroy()
          Destroy the cache
 int getCapacity()
           
 int getSize()
           
 void init(java.util.Properties properties)
          Initialize the cache using Properties
 void pageIn(java.lang.Object key, java.lang.Object object)
          Pages an object into the cache, affecting it's cache ranking.
 java.lang.Object pageOut(java.lang.Object key)
          Pages an object out of the cache, affecting it's cache ranking.
 void remove(java.lang.Object key)
          Removes an object from the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

capacity

protected int capacity

cacheDir

protected java.io.File cacheDir

cacheFilter

protected static LRUDiskCache.CacheFilter cacheFilter

modificationComparator

protected static LRUDiskCache.ModificationComparator modificationComparator

log

protected static org.apache.log4j.Logger log
Constructor Detail

LRUDiskCache

public LRUDiskCache()
Method Detail

init

public void init(java.util.Properties properties)
          throws CacheException
Description copied from interface: Cache
Initialize the cache using Properties

Specified by:
init in interface Cache
Throws:
CacheException

getCapacity

public int getCapacity()

getSize

public int getSize()

pageIn

public void pageIn(java.lang.Object key,
                   java.lang.Object object)
            throws CacheException
Description copied from interface: Cache
Pages an object into the cache, affecting it's cache ranking.

Specified by:
pageIn in interface Cache
Parameters:
key - the key
object - the object
Throws:
CacheException

pageOut

public java.lang.Object pageOut(java.lang.Object key)
                         throws CacheException
Description copied from interface: Cache
Pages an object out of the cache, affecting it's cache ranking.

Specified by:
pageOut in interface Cache
Parameters:
key - the object's cache key
Returns:
the object
Throws:
CacheException

remove

public void remove(java.lang.Object key)
            throws CacheException
Description copied from interface: Cache
Removes an object from the cache

Specified by:
remove in interface Cache
Parameters:
key - the object's cache key
Throws:
CacheException

destroy

public void destroy()
             throws CacheException
Description copied from interface: Cache
Destroy the cache

Specified by:
destroy in interface Cache
Throws:
CacheException


Copyright © 2004-2008 Sourceforge. All Rights Reserved.