|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.loaders.AbstractCacheLoader
org.infinispan.loaders.AbstractCacheStore
org.infinispan.loaders.LockSupportCacheStore
org.infinispan.loaders.bucket.BucketBasedCacheStore
public abstract class BucketBasedCacheStore
Base class for cache store that want to use the 'buckets approach' for storing data.
A hashing algorithm is used to map keys to buckets, and a bucket consists of a collection of key/value pairs. This approach, while adding an overhead of having to search buckets for keys, means that we can use any serializable object we like as keys and not just Strings or objects that translate to something meaningful for a store(e.g. file system).
Field Summary |
---|
Fields inherited from class org.infinispan.loaders.AbstractCacheStore |
---|
cache, marshaller, multiThreadedPurge, purgerService |
Constructor Summary | |
---|---|
BucketBasedCacheStore()
|
Method Summary | |
---|---|
protected String |
getLockFromKey(Object key)
For BucketBasedCacheStore s the lock should be acquired at bucket level. |
protected abstract void |
insertBucket(Bucket bucket)
|
protected abstract Bucket |
loadBucket(String keyHashCode)
Loads the bucket from the store, base on the hashcode. |
protected InternalCacheEntry |
loadLockSafe(Object key,
String lockingKey)
Loads the bucket coresponding to the given key, and lookups the key within it. |
protected boolean |
removeLockSafe(Object key,
String lockingKey)
Lookups a bucket where the given key is stored. |
protected abstract void |
saveBucket(Bucket bucket)
This method assumes that the bucket is already persisted in the database. |
protected void |
storeLockSafe(InternalCacheEntry ed,
String lockingKey)
Tries to find a bucket corresponding to storedEntry's key, and updates it with the storedEntry. |
Methods inherited from class org.infinispan.loaders.LockSupportCacheStore |
---|
acquireGlobalLock, clear, clearLockSafe, fromStream, fromStreamLockSafe, getTotalLockCount, immediateLockForWriting, init, load, loadAll, loadAllLockSafe, lockForReading, lockForWriting, releaseGlobalLock, remove, start, store, toStream, toStreamLockSafe, unlock |
Methods inherited from class org.infinispan.loaders.AbstractCacheStore |
---|
applyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, purgeInternal, removeAll, rollback, safeClose, safeClose, stop, supportsMultiThreadedPurge |
Methods inherited from class org.infinispan.loaders.AbstractCacheLoader |
---|
containsKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.infinispan.loaders.CacheLoader |
---|
containsKey, getConfigurationClass |
Constructor Detail |
---|
public BucketBasedCacheStore()
Method Detail |
---|
protected InternalCacheEntry loadLockSafe(Object key, String lockingKey) throws CacheLoaderException
loadLockSafe
in class LockSupportCacheStore
key
- the passed in key, from LockSupportCacheStore.load(Object)
lockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is present here in order to avoid hash recomputation.
CacheLoaderException
protected void storeLockSafe(InternalCacheEntry ed, String lockingKey) throws CacheLoaderException
storeLockSafe
in class LockSupportCacheStore
lockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is present here in order to avoid hash recomputation.
CacheLoaderException
protected boolean removeLockSafe(Object key, String lockingKey) throws CacheLoaderException
removeLockSafe
in class LockSupportCacheStore
lockingKey
- the hash of the key, as returned by LockSupportCacheStore.getLockFromKey(Object)
. This
is present here in order to avoid hash recomputation.
CacheLoaderException
protected String getLockFromKey(Object key)
BucketBasedCacheStore
s the lock should be acquired at bucket level. So we're locking based on the
hashCode of the key, as all keys having same hascode will be mapped to same bucket.
getLockFromKey
in class LockSupportCacheStore
protected abstract void insertBucket(Bucket bucket) throws CacheLoaderException
CacheLoaderException
protected abstract void saveBucket(Bucket bucket) throws CacheLoaderException
CacheLoaderException
- if the bucket is not already present, or something happens while persisting.protected abstract Bucket loadBucket(String keyHashCode) throws CacheLoaderException
CacheLoaderException
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |