public class SimpleTransientStore extends AbstractTransientStore
TransientStore. Uses StorageEntry as a
 representation of an entry in the store.| Modifier and Type | Field and Description | 
|---|---|
protected com.google.common.cache.Cache<String,Serializable> | 
l1Cache  | 
protected com.google.common.cache.Cache<String,Serializable> | 
l2Cache  | 
protected org.apache.commons.logging.Log | 
log  | 
protected AtomicLong | 
storageSize  | 
cacheDir, config| Constructor and Description | 
|---|
SimpleTransientStore()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected long | 
decrementStorageSize(long size)  | 
boolean | 
exists(String key)
Returns  
true if an entry exists with the given key. | 
List<Blob> | 
getBlobs(String key)
Gets the blobs associated with the entry with the given  
key. | 
com.google.common.cache.Cache<String,Serializable> | 
getL1Cache()  | 
com.google.common.cache.Cache<String,Serializable> | 
getL2Cache()  | 
Serializable | 
getParameter(String key,
            String parameter)
Gets the value of  
parameter in the entry with the given key. | 
Map<String,Serializable> | 
getParameters(String key)
Gets values of the parameters in the entry with the given  
key. | 
long | 
getSize(String key)
Returns the size of the blobs associated with the entry with the given  
key or -1 if entry does
 not exist. | 
protected StorageEntry | 
getStorageEntry(String key)
 | 
long | 
getStorageSize()
Returns the size (in bytes) of the disk storage used for blobs. 
 | 
protected long | 
incrementStorageSize(long size)  | 
void | 
init(TransientStoreConfig config)
Initializes the store from the given  
config. | 
boolean | 
isCompleted(String key)
Returns  
true if the entry with the given key is ready. | 
Set<String> | 
keySet()
Returns the set of keys for all entries. 
 | 
Stream<String> | 
keyStream()
Returns a  
Stream of keys for all entries. | 
protected void | 
persistBlobs(String key,
            long sizeOfBlobs,
            List<Map<String,String>> blobInfos)
Updates the total storage size and the storage size of the entry with the given  
key according to
 sizeOfBlobs and stores the blob information in this entry. | 
void | 
putParameter(String key,
            String parameter,
            Serializable value)
Sets  
parameter to value in the entry with the given key. | 
void | 
putParameters(String key,
             Map<String,Serializable> parameters)
Puts  
parameters in the entry with the given key. | 
protected void | 
putStorageEntry(String key,
               StorageEntry entry)
Stores the given  
entry with the given key. | 
void | 
release(String key)
Informs the store that the entry with the given  
key can be released if TTL or GC parameters require to do
 some cleanup. | 
protected void | 
removeAllEntries()  | 
protected void | 
removeEntry(String key)  | 
void | 
setCompleted(String key,
            boolean completed)
Marks the entry with the given  
key as ready. | 
protected void | 
setStorageSize(long newSize)
Sets the size of the disk storage in bytes. 
 | 
void | 
shutdown()
Shuts down the store. 
 | 
doGC, getCacheDir, getCachingDirectory, getCachingDirName, getFilePathSize, getKeyCachingDirName, getSizeOfBlobs, loadBlobs, putBlobs, remove, removeAll, removeBlobs, storeBlobsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetStorageSizeMBprotected org.apache.commons.logging.Log log
protected com.google.common.cache.Cache<String,Serializable> l1Cache
protected com.google.common.cache.Cache<String,Serializable> l2Cache
protected AtomicLong storageSize
public SimpleTransientStore()
public void init(TransientStoreConfig config)
TransientStoreProviderconfig.init in interface TransientStoreProviderinit in class AbstractTransientStorepublic void shutdown()
TransientStoreProvidershutdown in interface TransientStoreProvidershutdown in class AbstractTransientStorepublic boolean exists(String key)
TransientStoretrue if an entry exists with the given key.exists in interface TransientStoreexists in class AbstractTransientStorepublic Set<String> keySet()
TransientStoreProviderpublic Stream<String> keyStream()
TransientStoreProviderStream of keys for all entries.public void putParameter(String key, String parameter, Serializable value)
TransientStoreparameter to value in the entry with the given key.
 
 If entry does not exist a new entry is created. If parameter already exists in the entry it is
 overwritten.
putParameter in interface TransientStoreputParameter in class AbstractTransientStorepublic Serializable getParameter(String key, String parameter)
TransientStoreparameter in the entry with the given key.
 
 Returns null if entry or parameter does not exist.
getParameter in interface TransientStoregetParameter in class AbstractTransientStorepublic void putParameters(String key, Map<String,Serializable> parameters)
TransientStoreparameters in the entry with the given key. Overwrites any existing parameter in the entry.
 If entry does not exist a new entry is created.
putParameters in interface TransientStoreputParameters in class AbstractTransientStorepublic Map<String,Serializable> getParameters(String key)
TransientStorekey.
 
 Returns null if entry does not exist.
getParameters in interface TransientStoregetParameters in class AbstractTransientStorepublic List<Blob> getBlobs(String key)
TransientStorekey.
 
 Returns null if entry does not exist.
getBlobs in interface TransientStoregetBlobs in class AbstractTransientStorepublic long getSize(String key)
TransientStorekey or -1 if entry does
 not exist.getSize in interface TransientStoregetSize in class AbstractTransientStorepublic boolean isCompleted(String key)
TransientStoretrue if the entry with the given key is ready.isCompleted in interface TransientStoreisCompleted in class AbstractTransientStorepublic void setCompleted(String key, boolean completed)
TransientStorekey as ready.
 If entry does not exist a new entry is created.
setCompleted in interface TransientStoresetCompleted in class AbstractTransientStorepublic void release(String key)
TransientStorekey can be released if TTL or GC parameters require to do
 some cleanup.
 Has no effect if entry does not exist.
release in interface TransientStorerelease in class AbstractTransientStoreprotected void persistBlobs(String key, long sizeOfBlobs, List<Map<String,String>> blobInfos)
AbstractTransientStorekey according to
 sizeOfBlobs and stores the blob information in this entry.persistBlobs in class AbstractTransientStorepublic long getStorageSize()
TransientStoreProviderprotected void setStorageSize(long newSize)
AbstractTransientStoresetStorageSize in class AbstractTransientStoreprotected long incrementStorageSize(long size)
incrementStorageSize in class AbstractTransientStoreprotected long decrementStorageSize(long size)
decrementStorageSize in class AbstractTransientStoreprotected void removeEntry(String key)
removeEntry in class AbstractTransientStoreprotected void removeAllEntries()
removeAllEntries in class AbstractTransientStorepublic com.google.common.cache.Cache<String,Serializable> getL1Cache()
public com.google.common.cache.Cache<String,Serializable> getL2Cache()
protected StorageEntry getStorageEntry(String key)
protected void putStorageEntry(String key, StorageEntry entry)
entry with the given key.
 
 If an entry exists with the given key it is overwritten.
Copyright © 2019 Nuxeo. All rights reserved.