org.fjank.jcache.persistence
Class DiskCache

java.lang.Object
  extended by org.fjank.jcache.persistence.DiskCache
All Implemented Interfaces:
Serializable

public class DiskCache
extends Object
implements Serializable

Clas implementing a simple disk peristence solution.

See Also:
Serialized Form

Constructor Summary
DiskCache(CacheAttributes attributes)
          Creates a new DiskCache object.
 
Method Summary
 void close()
          closes the diskcache, and optimizes the disk files.
 CacheObject getObject(Serializable key)
          gets an object from the diskCache
 void removeAll()
          Will remove all objects in this diskcache.
 boolean update(CacheObject cacheElement)
          Adds the provided element to the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskCache

public DiskCache(CacheAttributes attributes)
          throws DiskCacheException
Creates a new DiskCache object.

Parameters:
attributes - the attributes for this disk cache.
Throws:
DiskCacheException
DiskCacheException - if any exceptions occur.
Method Detail

getObject

public final CacheObject getObject(Serializable key)
                            throws DiskCacheException
gets an object from the diskCache

Parameters:
key - the key for the object
Returns:
an object from the diskCache
Throws:
DiskCacheException - if exceptions occur.

close

public void close()
closes the diskcache, and optimizes the disk files.


update

public final boolean update(CacheObject cacheElement)
Adds the provided element to the cache.

Parameters:
cacheElement - the element to add.

removeAll

public void removeAll()
               throws DiskCacheException
Will remove all objects in this diskcache. Just a quick and dirty implementation to make things work.

Throws:
DiskCacheException - if removed was not successfull.


Copyright © 2002-2009 Hosted by SourceForge. All Rights Reserved.