public class FileCacheStore extends BucketBasedCacheStore
BucketBasedCacheStore
. This file store
stores stuff in the following format: /{location}/cache name/bucket_number.bucketModifier 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, purgerService
cache, 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, storeLockSafe
acquireGlobalLock, clear, downgradeLock, fromStream, getTotalLockCount, immediateLockForWriting, load, load, loadAll, loadAllKeys, lockForReading, lockForWriting, releaseGlobalLock, remove, store, toStream, unlock, upgradeLock
applyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClose
containsKey
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
containsKey
public 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
CacheLoader
CacheLoaderManager
when setting up cache loaders.init
in interface CacheLoader
init
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.CacheLoaderException
protected void loopOverBuckets(BucketBasedCacheStore.BucketHandler handler) throws CacheLoaderException
BucketBasedCacheStore
BucketBasedCacheStore.BucketHandler.handle(Bucket)
returns true or there are no more buckets available.
loopOverBuckets
in class BucketBasedCacheStore
CacheLoaderException
protected void fromStreamLockSafe(ObjectInput objectInput) throws CacheLoaderException
fromStreamLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected void toStreamLockSafe(ObjectOutput objectOutput) throws CacheLoaderException
toStreamLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected void clearLockSafe() throws CacheLoaderException
clearLockSafe
in class LockSupportCacheStore<Integer>
CacheLoaderException
protected boolean supportsMultiThreadedPurge()
supportsMultiThreadedPurge
in class AbstractCacheStore
protected void purgeInternal() throws CacheLoaderException
purgeInternal
in class AbstractCacheStore
CacheLoaderException
protected Bucket loadBucket(Integer hash) throws CacheLoaderException
BucketBasedCacheStore
loadBucket
in class BucketBasedCacheStore
hash
- 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
BucketBasedCacheStore
BucketBasedCacheStore.insertBucket(Bucket)
as well so that it doesn't blindly
forward calls to BucketBasedCacheStore.updateBucket(Bucket)
.
updateBucket
in class BucketBasedCacheStore
b
- bucket to update.CacheLoaderException
- in case of problems with the store.public Class<? extends CacheLoaderConfig> getConfigurationClass()
CacheLoader
CacheLoaderConfig
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 CacheLoader
start
in class LockSupportCacheStore<Integer>
CacheLoaderException
public void stop() throws CacheLoaderException
stop
in interface CacheLoader
stop
in class AbstractCacheStore
CacheLoaderException
public Bucket loadBucketContainingKey(String key) throws CacheLoaderException
CacheLoaderException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.