org.infinispan.loaders
Interface CacheLoader

All Known Subinterfaces:
CacheStore
All Known Implementing Classes:
AbstractCacheLoader, AbstractCacheStore, AbstractDelegatingStore, AsyncStore, BdbjeCacheStore, BucketBasedCacheStore, ChainingCacheStore, CloudCacheStore, ClusterCacheLoader, FileCacheStore, JdbcBinaryCacheStore, JdbcMixedCacheStore, JdbcStringBasedCacheStore, JdbmCacheStore, LockSupportCacheStore, ReadOnlyStore, SingletonStore

public interface CacheLoader

Responsible for loading cache data from an external source

Since:
4.0
Author:
Manik Surtani

Method Summary
 boolean containsKey(Object key)
           
 Class<? extends CacheLoaderConfig> getConfigurationClass()
           
 void init(CacheLoaderConfig config, Cache<?,?> cache, Marshaller m)
          Used to initialize a cache loader.
 InternalCacheEntry load(Object key)
          Loads an entry mapped to by a given key.
 Set<InternalCacheEntry> loadAll()
          Loads all entries in the loader.
 void start()
           
 void stop()
           
 

Method Detail

init

void init(CacheLoaderConfig config,
          Cache<?,?> cache,
          Marshaller m)
          throws CacheLoaderException
Used to initialize a cache loader. Typically invoked by the CacheLoaderManager when setting up cache loaders.

Parameters:
config - the cache loader configuration bean
cache - cache associated with this cache loader. Implementations may use this to determine cache name when selecting where refer to state in storage, for example, a different database table name.
m - marshaller to use when loading state from a stream, if supported by the implementation.
Throws:
CacheLoaderException

load

InternalCacheEntry load(Object key)
                        throws CacheLoaderException
Loads an entry mapped to by a given key. Should return null if the entry does not exist. Expired entries are not returned.

Parameters:
key - key
Returns:
an entry
Throws:
CacheLoaderException - in the event of problems reading from source

loadAll

Set<InternalCacheEntry> loadAll()
                                throws CacheLoaderException
Loads all entries in the loader. Expired entries are not returned.

Returns:
a set of entries, or an empty set if the loader is emptied.
Throws:
CacheLoaderException - in the event of problems reading from source

containsKey

boolean containsKey(Object key)
                    throws CacheLoaderException
Parameters:
key - key to test
Returns:
true if the key exists, false otherwise
Throws:
CacheLoaderException - in the event of problems reading from source

start

void start()
           throws CacheLoaderException
Throws:
CacheLoaderException

stop

void stop()
          throws CacheLoaderException
Throws:
CacheLoaderException

getConfigurationClass

Class<? extends CacheLoaderConfig> getConfigurationClass()
Returns:
the type of the CacheLoaderConfig bean used to configure this implementation of CacheLoader

Google Analytics

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