org.infinispan.loaders.jdbm
Class JdbmCacheStore

java.lang.Object
  extended by org.infinispan.loaders.AbstractCacheLoader
      extended by org.infinispan.loaders.AbstractCacheStore
          extended by org.infinispan.loaders.jdbm.JdbmCacheStore
All Implemented Interfaces:
CacheLoader, CacheStore

@ThreadSafe
public class JdbmCacheStore
extends AbstractCacheStore

A persistent CacheLoader based on the JDBM project. See http://jdbm.sourceforge.net/ . Does not support transaction isolation.

Supports removal of expired entries.

It would probably be better if meta-data (expiry time) was stored independent of the value of the entry. That is, if (key,"m") == meta and (key,"v") == value.

Version:
$Id: JdbmCacheLoader.java 7261 2008-12-07 18:53:38Z genman $
Author:
Elias Ross

Field Summary
 
Fields inherited from class org.infinispan.loaders.AbstractCacheStore
marshaller
 
Constructor Summary
JdbmCacheStore()
           
 
Method Summary
protected  void applyModifications(List<? extends Modification> mods)
           
 void clear()
           
 void fromStream(ObjectInput in)
          Reads from a stream the number of entries (long) then the entries themselves.
 Class<? extends CacheLoaderConfig> getConfigurationClass()
           
 void init(CacheLoaderConfig clc, Cache cache, Marshaller m)
           
 InternalCacheEntry load(Object key)
           
 Set<InternalCacheEntry> loadAll()
           
protected  void purgeInternal()
          Purge expired entries.
 boolean remove(Object key)
           
 boolean remove0(Object key)
           
 void start()
           
 void stop()
          Closes all databases, ignoring exceptions, and nulls references to all database related information.
 void store(InternalCacheEntry entry)
           
 void toStream(ObjectOutput out)
          Writes to a stream the number of entries (long) then the entries themselves.
 String toString()
           
 
Methods inherited from class org.infinispan.loaders.AbstractCacheStore
commit, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClose
 
Methods inherited from class org.infinispan.loaders.AbstractCacheLoader
containsKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.infinispan.loaders.CacheLoader
containsKey
 

Constructor Detail

JdbmCacheStore

public JdbmCacheStore()
Method Detail

getConfigurationClass

public Class<? extends CacheLoaderConfig> getConfigurationClass()

init

public void init(CacheLoaderConfig clc,
                 Cache cache,
                 Marshaller m)
Specified by:
init in interface CacheLoader
Overrides:
init in class AbstractCacheStore

start

public void start()
           throws CacheLoaderException
Specified by:
start in interface CacheLoader
Overrides:
start in class AbstractCacheStore
Throws:
CacheLoaderException

load

public InternalCacheEntry load(Object key)
                        throws CacheLoaderException
Throws:
CacheLoaderException

loadAll

public Set<InternalCacheEntry> loadAll()
                                throws CacheLoaderException
Throws:
CacheLoaderException

stop

public void stop()
Closes all databases, ignoring exceptions, and nulls references to all database related information.

Specified by:
stop in interface CacheLoader
Overrides:
stop in class AbstractCacheStore

clear

public void clear()
           throws CacheLoaderException
Throws:
CacheLoaderException

remove

public boolean remove(Object key)
               throws CacheLoaderException
Throws:
CacheLoaderException

remove0

public boolean remove0(Object key)
                throws CacheLoaderException
Throws:
CacheLoaderException

store

public void store(InternalCacheEntry entry)
           throws CacheLoaderException
Throws:
CacheLoaderException

toStream

public void toStream(ObjectOutput out)
              throws CacheLoaderException
Writes to a stream the number of entries (long) then the entries themselves.

Throws:
CacheLoaderException

fromStream

public void fromStream(ObjectInput in)
                throws CacheLoaderException
Reads from a stream the number of entries (long) then the entries themselves.

Throws:
CacheLoaderException

purgeInternal

protected void purgeInternal()
                      throws CacheLoaderException
Purge expired entries.

Overrides:
purgeInternal in class AbstractCacheStore
Throws:
CacheLoaderException

applyModifications

protected void applyModifications(List<? extends Modification> mods)
                           throws CacheLoaderException
Overrides:
applyModifications in class AbstractCacheStore
Throws:
CacheLoaderException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.