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 | Field and Description |
---|---|
protected int |
firstLevelTTL |
protected org.apache.commons.logging.Log |
log |
protected String |
namespace |
protected RedisAdmin |
redisAdmin |
protected RedisExecutor |
redisExecutor |
protected int |
secondLevelTTL |
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) |
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, storeBlobs
protected RedisExecutor redisExecutor
protected RedisAdmin redisAdmin
protected int firstLevelTTL
protected int secondLevelTTL
protected org.apache.commons.logging.Log log
public RedisTransientStore()
public void init(TransientStoreConfig config)
TransientStore
config
.init
in interface TransientStore
init
in class AbstractTransientStore
public void shutdown()
TransientStore
shutdown
in interface TransientStore
shutdown
in class AbstractTransientStore
public boolean exists(String key)
TransientStore
true
if an entry exists with the given key
.exists
in interface TransientStore
exists
in class AbstractTransientStore
public void putParameter(String key, String parameter, Serializable value)
TransientStore
parameter
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 TransientStore
putParameter
in class AbstractTransientStore
public Serializable getParameter(String key, String parameter)
TransientStore
parameter
in the entry with the given key
.
Returns null
if entry or parameter does not exist.
getParameter
in interface TransientStore
getParameter
in class AbstractTransientStore
public void putParameters(String key, Map<String,Serializable> parameters)
TransientStore
parameters
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 TransientStore
putParameters
in class AbstractTransientStore
public Map<String,Serializable> getParameters(String key)
TransientStore
key
.
Returns null
if entry does not exist.
getParameters
in interface TransientStore
getParameters
in class AbstractTransientStore
public List<Blob> getBlobs(String key)
TransientStore
key
.
Returns null
if entry does not exist.
getBlobs
in interface TransientStore
getBlobs
in class AbstractTransientStore
public long getSize(String key)
TransientStore
key
or -1
if entry does
not exist.getSize
in interface TransientStore
getSize
in class AbstractTransientStore
public boolean isCompleted(String key)
TransientStore
true
if the entry with the given key
is ready.isCompleted
in interface TransientStore
isCompleted
in class AbstractTransientStore
public void setCompleted(String key, boolean completed)
TransientStore
key
as ready.
If entry does not exist a new entry is created.
setCompleted
in interface TransientStore
setCompleted
in class AbstractTransientStore
public void remove(String key)
TransientStore
key
.
Has no effect if entry does not exist.
remove
in interface TransientStore
remove
in class AbstractTransientStore
public void release(String key)
TransientStore
key
can be released if TTL or GC parameters require to do
some cleanup.
Has no effect if entry does not exist.
release
in interface TransientStore
release
in class AbstractTransientStore
protected void persistBlobs(String key, long sizeOfBlobs, List<Map<String,String>> blobInfos)
AbstractTransientStore
key
according to
sizeOfBlobs
and stores the blob information in this entry.persistBlobs
in class AbstractTransientStore
public long getStorageSize()
AbstractTransientStore
getStorageSize
in class AbstractTransientStore
protected void setStorageSize(long newSize)
AbstractTransientStore
setStorageSize
in class AbstractTransientStore
protected long incrementStorageSize(long size)
incrementStorageSize
in class AbstractTransientStore
protected long decrementStorageSize(long size)
decrementStorageSize
in class AbstractTransientStore
protected void removeAllEntries()
removeAllEntries
in class AbstractTransientStore
protected 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 © 2015 Nuxeo SA. All rights reserved.