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
FieldsModifier and TypeFieldDescriptionprotected com.google.common.cache.Cache<String, Serializable> protected com.google.common.cache.Cache<String, Serializable> protected AtomicLongFields inherited from class org.nuxeo.ecm.core.transientstore.AbstractTransientStore
cacheDir, config -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longdecrementStorageSize(long size) booleanReturnstrueif 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 ofparameterin the entry with the givenkey.getParameters(String key) Gets values of the parameters in the entry with the givenkey.longReturns the size of the blobs associated with the entry with the givenkeyor-1if entry does not exist.protected StorageEntrygetStorageEntry(String key) longReturns the size (in bytes) of the disk storage used for blobs.protected longincrementStorageSize(long size) voidinit(TransientStoreConfig config) Initializes the store from the givenconfig.booleanisCompleted(String key) Returnstrueif the entry with the givenkeyis ready.keySet()Returns the set of keys for all entries.Returns aStreamof keys for all entries.protected voidUpdates the total storage size and the storage size of the entry with the givenkeyaccording tosizeOfBlobsand stores the blob information in this entry.voidputParameter(String key, String parameter, Serializable value) Setsparametertovaluein the entry with the givenkey.voidputParameters(String key, Map<String, Serializable> parameters) Putsparametersin the entry with the givenkey.protected voidputStorageEntry(String key, StorageEntry entry) Stores the givenentrywith the givenkey.voidInforms the store that the entry with the givenkeycan be released if TTL or GC parameters require to do some cleanup.protected voidprotected voidremoveEntry(String key) voidsetCompleted(String key, boolean completed) Marks the entry with the givenkeyas ready.protected voidsetStorageSize(long newSize) Sets the size of the disk storage in bytes.voidshutdown()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:TransientStoreProviderInitializes the store from the givenconfig.- Specified by:
initin interfaceTransientStoreProvider- Overrides:
initin classAbstractTransientStore
-
shutdown
public void shutdown()Description copied from interface:TransientStoreProviderShuts down the store.- Specified by:
shutdownin interfaceTransientStoreProvider- Specified by:
shutdownin classAbstractTransientStore
-
exists
Description copied from interface:TransientStoreReturnstrueif an entry exists with the givenkey.- Specified by:
existsin interfaceTransientStore- Specified by:
existsin classAbstractTransientStore
-
keySet
Description copied from interface:TransientStoreProviderReturns the set of keys for all entries. -
keyStream
Description copied from interface:TransientStoreProviderReturns aStreamof keys for all entries. -
putParameter
Description copied from interface:TransientStoreSetsparametertovaluein the entry with the givenkey.If entry does not exist a new entry is created. If
parameteralready exists in the entry it is overwritten.- Specified by:
putParameterin interfaceTransientStore- Specified by:
putParameterin classAbstractTransientStore
-
getParameter
Description copied from interface:TransientStoreGets the value ofparameterin the entry with the givenkey.Returns
nullif entry or parameter does not exist.- Specified by:
getParameterin interfaceTransientStore- Specified by:
getParameterin classAbstractTransientStore
-
putParameters
Description copied from interface:TransientStorePutsparametersin the entry with the givenkey. Overwrites any existing parameter in the entry.If entry does not exist a new entry is created.
- Specified by:
putParametersin interfaceTransientStore- Specified by:
putParametersin classAbstractTransientStore
-
getParameters
Description copied from interface:TransientStoreGets values of the parameters in the entry with the givenkey.Returns
nullif entry does not exist.- Specified by:
getParametersin interfaceTransientStore- Specified by:
getParametersin classAbstractTransientStore
-
getBlobs
Description copied from interface:TransientStoreGets the blobs associated with the entry with the givenkey.Returns
nullif entry does not exist.- Specified by:
getBlobsin interfaceTransientStore- Specified by:
getBlobsin classAbstractTransientStore
-
getSize
Description copied from interface:TransientStoreReturns the size of the blobs associated with the entry with the givenkeyor-1if entry does not exist.- Specified by:
getSizein interfaceTransientStore- Specified by:
getSizein classAbstractTransientStore
-
isCompleted
Description copied from interface:TransientStoreReturnstrueif the entry with the givenkeyis ready.- Specified by:
isCompletedin interfaceTransientStore- Specified by:
isCompletedin classAbstractTransientStore
-
setCompleted
Description copied from interface:TransientStoreMarks the entry with the givenkeyas ready.If entry does not exist a new entry is created.
- Specified by:
setCompletedin interfaceTransientStore- Specified by:
setCompletedin classAbstractTransientStore
-
release
Description copied from interface:TransientStoreInforms the store that the entry with the givenkeycan be released if TTL or GC parameters require to do some cleanup.Has no effect if entry does not exist.
- Specified by:
releasein interfaceTransientStore- Specified by:
releasein classAbstractTransientStore
-
persistBlobs
Description copied from class:AbstractTransientStoreUpdates the total storage size and the storage size of the entry with the givenkeyaccording tosizeOfBlobsand stores the blob information in this entry.- Specified by:
persistBlobsin classAbstractTransientStore
-
getStorageSize
public long getStorageSize()Description copied from interface:TransientStoreProviderReturns 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:AbstractTransientStoreSets the size of the disk storage in bytes.- Specified by:
setStorageSizein classAbstractTransientStore
-
incrementStorageSize
protected long incrementStorageSize(long size) - Specified by:
incrementStorageSizein classAbstractTransientStore
-
decrementStorageSize
protected long decrementStorageSize(long size) - Specified by:
decrementStorageSizein classAbstractTransientStore
-
removeEntry
- Specified by:
removeEntryin classAbstractTransientStore
-
removeAllEntries
protected void removeAllEntries()- Specified by:
removeAllEntriesin classAbstractTransientStore
-
getL1Cache
-
getL2Cache
-
getStorageEntry
-
putStorageEntry
Stores the givenentrywith the givenkey.If an entry exists with the given
keyit is overwritten.
-