public class RedisTransientStore extends AbstractTransientStore
TransientStore.
Since hashes cannot be nested, a storage entry is flattened as follows:
- Entry summary:
transientStore:transientStoreName:entryKey {
"blobCount": number of blobs associated with the entry
"size": storage size of the blobs associated with the entry
"completed": entry status
}
- Entry parameters:
transientStore:transientStoreName:entryKey:params {
"param1": value1
"param2": value2
}
- Entry blobs:
transientStore:transientStoreName:entryKey:blobs:0 {
"file"
"filename"
"encoding"
"mimetype"
"digest"
}
transientStore:transientStoreName:entryKey:blobs:1 {
...
}
...
| Modifier and Type | Class and Description |
|---|---|
protected class |
RedisTransientStore.KeyMatcher |
| Modifier and Type | Field and Description |
|---|---|
protected int |
firstLevelTTL |
protected RedisTransientStore.KeyMatcher |
keyMatcher |
protected org.apache.commons.logging.Log |
log |
protected String |
namespace |
protected RedisAdmin |
redisAdmin |
protected RedisExecutor |
redisExecutor |
protected int |
secondLevelTTL |
protected static String |
SIZE_KEY |
protected String |
sizeKey |
cacheDir, config| Constructor and Description |
|---|
RedisTransientStore() |
| Modifier and Type | Method and Description |
|---|---|
protected long |
decrementStorageSize(long size) |
protected void |
deleteBlobInfos(String key,
String blobCountStr) |
protected Serializable |
deserialize(byte[] bytes) |
protected Map<String,Serializable> |
deserialize(Map<byte[],byte[]> byteMap) |
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. |
protected byte[] |
getBytes(String key) |
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. |
long |
getStorageSize()
Returns the size of the disk storage in bytes.
|
protected String |
getString(byte[] bytes) |
protected Map<String,String> |
getSummary(String key) |
long |
getTTL(String key) |
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. |
protected String |
join(String... fragments) |
Set<String> |
keySet()
Returns the set 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. |
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. |
void |
remove(String key)
Removes entry with the given
key. |
protected void |
removeAllEntries() |
protected Map<byte[],byte[]> |
serialize(Map<String,Serializable> map) |
protected byte[] |
serialize(Serializable value) |
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.
|
protected void |
setTTL(String key,
int seconds) |
void |
shutdown()
Shuts down the store.
|
doGC, getCachingDirectory, getCachingDirName, getFilePathSize, getKeyCachingDirName, getSizeOfBlobs, getStorageSizeMB, loadBlobs, putBlobs, removeAll, storeBlobsprotected static final String SIZE_KEY
protected RedisExecutor redisExecutor
protected RedisTransientStore.KeyMatcher keyMatcher
protected RedisAdmin redisAdmin
protected int firstLevelTTL
protected int secondLevelTTL
protected org.apache.commons.logging.Log log
public RedisTransientStore()
public void init(TransientStoreConfig config)
TransientStoreconfig.init in interface TransientStoreinit in class AbstractTransientStorepublic void shutdown()
TransientStoreshutdown in interface TransientStoreshutdown 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()
TransientStorekeySet in interface TransientStorekeySet in class AbstractTransientStorepublic 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 remove(String key)
TransientStorekey.
Has no effect if entry does not exist.
remove in interface TransientStoreremove 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()
AbstractTransientStoregetStorageSize in class AbstractTransientStoreprotected 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 removeAllEntries()
removeAllEntries in class AbstractTransientStoreprotected Map<String,String> getSummary(String key)
protected void deleteBlobInfos(String key, String blobCountStr)
protected byte[] serialize(Serializable value)
protected Serializable deserialize(byte[] bytes)
protected Map<byte[],byte[]> serialize(Map<String,Serializable> map)
protected Map<String,Serializable> deserialize(Map<byte[],byte[]> byteMap)
Copyright © 2016 Nuxeo SA. All rights reserved.