public class FileCacheStore extends BucketBasedCacheStore
BucketBasedCacheStore. This file store
stores stuff in the following format: /{location}/cache name/bucket_number.bucket| Modifier and Type | Class and Description |
|---|---|
static class |
FileCacheStore.NumericNamedFilesFilter
Makes sure that files opened are actually named as numbers (ignore all other files)
|
BucketBasedCacheStore.BucketHandler, BucketBasedCacheStore.CollectionGeneratingBucketHandler<T>| Modifier and Type | Field and Description |
|---|---|
static FileCacheStore.NumericNamedFilesFilter |
NUMERIC_NAMED_FILES_FILTER |
multiThreadedPurge, purgerServicecache, marshaller| Constructor and Description |
|---|
FileCacheStore() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearLockSafe() |
protected void |
fromStreamLockSafe(ObjectInput objectInput) |
Class<? extends CacheLoaderConfig> |
getConfigurationClass()
This method is used by the configuration parser to get a hold of the CacheLoader implementation's corresponding
CacheLoaderConfig type. |
File |
getRoot() |
void |
init(CacheLoaderConfig config,
Cache<?,?> cache,
StreamingMarshaller m)
Used to initialize a cache loader.
|
protected Bucket |
loadBucket(File bucketFile) |
protected Bucket |
loadBucket(Integer hash)
Loads a Bucket from the store, based on the hash code of the bucket.
|
Bucket |
loadBucketContainingKey(String key) |
protected void |
loopOverBuckets(BucketBasedCacheStore.BucketHandler handler)
A mechanism to loop over all buckets in the cache store.
|
protected void |
purgeInternal() |
void |
start() |
void |
stop() |
protected boolean |
supportsMultiThreadedPurge() |
protected void |
toStreamLockSafe(ObjectOutput objectOutput) |
void |
updateBucket(Bucket b)
Updates a bucket in the store with the Bucket passed in to the method.
|
getLockFromKey, insertBucket, loadAllKeysLockSafe, loadAllLockSafe, loadLockSafe, loadLockSafe, removeLockSafe, storeLockSafeacquireGlobalLock, clear, downgradeLock, fromStream, getTotalLockCount, immediateLockForWriting, load, load, loadAll, loadAllKeys, lockForReading, lockForWriting, releaseGlobalLock, remove, store, toStream, unlock, upgradeLockapplyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClosecontainsKeyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsKeypublic static final FileCacheStore.NumericNamedFilesFilter NUMERIC_NAMED_FILES_FILTER
public File getRoot()
CacheStore are written.public void init(CacheLoaderConfig config, Cache<?,?> cache, StreamingMarshaller m) throws CacheLoaderException
CacheLoaderCacheLoaderManager
when setting up cache loaders.init in interface CacheLoaderinit in class LockSupportCacheStore<Integer>config - the cache loader configuration beancache - 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.CacheLoaderExceptionprotected void loopOverBuckets(BucketBasedCacheStore.BucketHandler handler) throws CacheLoaderException
BucketBasedCacheStoreBucketBasedCacheStore.BucketHandler.handle(Bucket)
returns true or there are no more buckets available.
loopOverBuckets in class BucketBasedCacheStoreCacheLoaderExceptionprotected void fromStreamLockSafe(ObjectInput objectInput) throws CacheLoaderException
fromStreamLockSafe in class LockSupportCacheStore<Integer>CacheLoaderExceptionprotected void toStreamLockSafe(ObjectOutput objectOutput) throws CacheLoaderException
toStreamLockSafe in class LockSupportCacheStore<Integer>CacheLoaderExceptionprotected void clearLockSafe()
throws CacheLoaderException
clearLockSafe in class LockSupportCacheStore<Integer>CacheLoaderExceptionprotected boolean supportsMultiThreadedPurge()
supportsMultiThreadedPurge in class AbstractCacheStoreprotected void purgeInternal()
throws CacheLoaderException
purgeInternal in class AbstractCacheStoreCacheLoaderExceptionprotected Bucket loadBucket(Integer hash) throws CacheLoaderException
BucketBasedCacheStoreloadBucket in class BucketBasedCacheStorehash - the Bucket's hashCacheLoaderException - in case of problems with the store.protected Bucket loadBucket(File bucketFile) throws CacheLoaderException, InterruptedException
public void updateBucket(Bucket b) throws CacheLoaderException
BucketBasedCacheStoreBucketBasedCacheStore.insertBucket(Bucket) as well so that it doesn't blindly
forward calls to BucketBasedCacheStore.updateBucket(Bucket).
updateBucket in class BucketBasedCacheStoreb - bucket to update.CacheLoaderException - in case of problems with the store.public Class<? extends CacheLoaderConfig> getConfigurationClass()
CacheLoaderCacheLoaderConfig type. This is usually done by instantiating the CacheLoader
and then calling this method. This may result in 2 instances being created, however, since the instance
created to get a hold of the configuration type is then discarded and another instance is created for actual
use as a CacheLoader when the cache starts.
Since Infinispan 4.1, you can also annotate your CacheLoader implementation with CacheLoaderMetadata
and provide this information via the annotation, which will prevent unnecessary instances being created.
CacheLoaderConfig bean used to configure this
implementation of CacheLoader.public void start()
throws CacheLoaderException
start in interface CacheLoaderstart in class LockSupportCacheStore<Integer>CacheLoaderExceptionpublic void stop()
throws CacheLoaderException
stop in interface CacheLoaderstop in class AbstractCacheStoreCacheLoaderExceptionpublic Bucket loadBucketContainingKey(String key) throws CacheLoaderException
CacheLoaderExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.