Class SimpleTransientStore
java.lang.Object
org.nuxeo.ecm.core.transientstore.AbstractTransientStore
org.nuxeo.ecm.core.transientstore.SimpleTransientStore
- All Implemented Interfaces:
TransientStore
,TransientStoreProvider
Default implementation (i.e., not cluster aware) of the
TransientStore
. Uses StorageEntry
as a
representation of an entry in the store.- Since:
- 7.2
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.google.common.cache.Cache<String,
Serializable> protected com.google.common.cache.Cache<String,
Serializable> protected AtomicLong
Fields inherited from class org.nuxeo.ecm.core.transientstore.AbstractTransientStore
cacheDir, config
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected long
decrementStorageSize
(long size) boolean
Returnstrue
if an entry exists with the givenkey
.Gets the blobs associated with the entry with the givenkey
.com.google.common.cache.Cache<String,
Serializable> com.google.common.cache.Cache<String,
Serializable> getParameter
(String key, String parameter) Gets the value ofparameter
in the entry with the givenkey
.getParameters
(String key) Gets values of the parameters in the entry with the givenkey
.long
Returns the size of the blobs associated with the entry with the givenkey
or-1
if entry does not exist.protected StorageEntry
getStorageEntry
(String key) long
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 givenconfig
.boolean
isCompleted
(String key) Returnstrue
if the entry with the givenkey
is ready.keySet()
Returns the set of keys for all entries.Returns aStream
of keys for all entries.protected void
Updates the total storage size and the storage size of the entry with the givenkey
according tosizeOfBlobs
and stores the blob information in this entry.void
putParameter
(String key, String parameter, Serializable value) Setsparameter
tovalue
in the entry with the givenkey
.void
putParameters
(String key, Map<String, Serializable> parameters) Putsparameters
in the entry with the givenkey
.protected void
putStorageEntry
(String key, StorageEntry entry) Stores the givenentry
with the givenkey
.void
Informs the store that the entry with the givenkey
can be released if TTL or GC parameters require to do some cleanup.protected void
protected void
removeEntry
(String key) void
setCompleted
(String key, boolean completed) Marks the entry with the givenkey
as ready.protected void
setStorageSize
(long newSize) Sets the size of the disk storage in bytes.void
shutdown()
Shuts down the store.Methods inherited from class org.nuxeo.ecm.core.transientstore.AbstractTransientStore
doGC, getCacheDir, getCachingDirectory, getCachingDirName, getFilePathSize, getKeyCachingDirName, getSizeOfBlobs, loadBlobs, putBlobs, remove, removeAll, removeBlobs, storeBlobs
-
Field Details
-
l1Cache
-
l2Cache
-
storageSize
-
-
Constructor Details
-
SimpleTransientStore
public SimpleTransientStore()
-
-
Method Details
-
init
Description copied from interface:TransientStoreProvider
Initializes the store from the givenconfig
.- Specified by:
init
in interfaceTransientStoreProvider
- Overrides:
init
in classAbstractTransientStore
-
shutdown
public void shutdown()Description copied from interface:TransientStoreProvider
Shuts down the store.- Specified by:
shutdown
in interfaceTransientStoreProvider
- Specified by:
shutdown
in classAbstractTransientStore
-
exists
Description copied from interface:TransientStore
Returnstrue
if an entry exists with the givenkey
.- Specified by:
exists
in interfaceTransientStore
- Specified by:
exists
in classAbstractTransientStore
-
keySet
Description copied from interface:TransientStoreProvider
Returns the set of keys for all entries. -
keyStream
Description copied from interface:TransientStoreProvider
Returns aStream
of keys for all entries. -
putParameter
Description copied from interface:TransientStore
Setsparameter
tovalue
in the entry with the givenkey
.If entry does not exist a new entry is created. If
parameter
already exists in the entry it is overwritten.- Specified by:
putParameter
in interfaceTransientStore
- Specified by:
putParameter
in classAbstractTransientStore
-
getParameter
Description copied from interface:TransientStore
Gets the value ofparameter
in the entry with the givenkey
.Returns
null
if entry or parameter does not exist.- Specified by:
getParameter
in interfaceTransientStore
- Specified by:
getParameter
in classAbstractTransientStore
-
putParameters
Description copied from interface:TransientStore
Putsparameters
in the entry with the givenkey
. Overwrites any existing parameter in the entry.If entry does not exist a new entry is created.
- Specified by:
putParameters
in interfaceTransientStore
- Specified by:
putParameters
in classAbstractTransientStore
-
getParameters
Description copied from interface:TransientStore
Gets values of the parameters in the entry with the givenkey
.Returns
null
if entry does not exist.- Specified by:
getParameters
in interfaceTransientStore
- Specified by:
getParameters
in classAbstractTransientStore
-
getBlobs
Description copied from interface:TransientStore
Gets the blobs associated with the entry with the givenkey
.Returns
null
if entry does not exist.- Specified by:
getBlobs
in interfaceTransientStore
- Specified by:
getBlobs
in classAbstractTransientStore
-
getSize
Description copied from interface:TransientStore
Returns the size of the blobs associated with the entry with the givenkey
or-1
if entry does not exist.- Specified by:
getSize
in interfaceTransientStore
- Specified by:
getSize
in classAbstractTransientStore
-
isCompleted
Description copied from interface:TransientStore
Returnstrue
if the entry with the givenkey
is ready.- Specified by:
isCompleted
in interfaceTransientStore
- Specified by:
isCompleted
in classAbstractTransientStore
-
setCompleted
Description copied from interface:TransientStore
Marks the entry with the givenkey
as ready.If entry does not exist a new entry is created.
- Specified by:
setCompleted
in interfaceTransientStore
- Specified by:
setCompleted
in classAbstractTransientStore
-
release
Description copied from interface:TransientStore
Informs the store that the entry with the givenkey
can be released if TTL or GC parameters require to do some cleanup.Has no effect if entry does not exist.
- Specified by:
release
in interfaceTransientStore
- Specified by:
release
in classAbstractTransientStore
-
persistBlobs
Description copied from class:AbstractTransientStore
Updates the total storage size and the storage size of the entry with the givenkey
according tosizeOfBlobs
and stores the blob information in this entry.- Specified by:
persistBlobs
in classAbstractTransientStore
-
getStorageSize
public long getStorageSize()Description copied from interface:TransientStoreProvider
Returns the size (in bytes) of the disk storage used for blobs.- Returns:
- the number of bytes used by stored blobs
-
setStorageSize
protected void setStorageSize(long newSize) Description copied from class:AbstractTransientStore
Sets the size of the disk storage in bytes.- Specified by:
setStorageSize
in classAbstractTransientStore
-
incrementStorageSize
protected long incrementStorageSize(long size) - Specified by:
incrementStorageSize
in classAbstractTransientStore
-
decrementStorageSize
protected long decrementStorageSize(long size) - Specified by:
decrementStorageSize
in classAbstractTransientStore
-
removeEntry
- Specified by:
removeEntry
in classAbstractTransientStore
-
removeAllEntries
protected void removeAllEntries()- Specified by:
removeAllEntries
in classAbstractTransientStore
-
getL1Cache
-
getL2Cache
-
getStorageEntry
-
putStorageEntry
Stores the givenentry
with the givenkey
.If an entry exists with the given
key
it is overwritten.
-