Class UploadedFileCacheService
java.lang.Object
fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,byte[]>
fr.paris.lutece.plugins.asynchronousupload.service.UploadedFileCacheService
- All Implemented Interfaces:
IUploadedFileStore,fr.paris.lutece.portal.service.cache.CacheableService<String,,byte[]> fr.paris.lutece.portal.service.cache.Lutece107Cache<String,,byte[]> fr.paris.lutece.portal.service.util.LuteceService,Closeable,Serializable,AutoCloseable,Iterable<javax.cache.Cache.Entry<String,,byte[]>> javax.cache.Cache<String,byte[]>
@ApplicationScoped
public class UploadedFileCacheService
extends fr.paris.lutece.portal.service.cache.AbstractCacheableService<String,byte[]>
implements IUploadedFileStore
Keeps the content of the uploaded files in a cache shared by the instances, when the cache provider is distributed. With one
instance (Ehcache) the files stay in the session: nothing is stored here.
The cache is required (never disabled from the back office) and never reset: it holds files the users are still working on. Each file is removed when it is deleted (removed from the form, form submitted, session destroyed); the time to live only purges the files of the sessions lost without notice.
- See Also:
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the content of an uploaded filegetName()voidinit()Creates the cachebooleanisActive()Tells whether the content of the uploaded files is kept outside the sessionbyte[]Loads the content of an uploaded filestore(byte[] content) Stores the content of an uploaded fileMethods inherited from class fr.paris.lutece.portal.service.cache.AbstractCacheableService
clear, close, containsKey, deregisterCacheEntryListener, enableCache, get, getAll, getAndPut, getAndRemove, getAndReplace, getCache, getCacheManager, getCacheSize, getConfiguration, getFromCache, getInfos, getKeys, initCache, initCache, initCache, invoke, invokeAll, isCacheEnable, isClosed, isPreventGlobalReset, isPreventReset, isRequired, iterator, loadAll, put, putAll, putIfAbsent, putInCache, registerCacheEntryListener, remove, remove, removeAll, removeAll, removeKey, replace, replace, resetCache, setCache, unwrapMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.paris.lutece.portal.service.cache.CacheableService
getMaxElements, getMemorySize, getTimeToLiveMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
UploadedFileCacheService
public UploadedFileCacheService()
-
-
Method Details
-
init
@PostConstruct public void init()Creates the cache -
getName
- Specified by:
getNamein interfacejavax.cache.Cache<String,byte[]> - Specified by:
getNamein interfacefr.paris.lutece.portal.service.util.LuteceService
-
isActive
public boolean isActive()Tells whether the content of the uploaded files is kept outside the session- Specified by:
isActivein interfaceIUploadedFileStore- Returns:
- true when the files are stored here, false when they stay in the session (one instance)
-
store
Stores the content of an uploaded file- Specified by:
storein interfaceIUploadedFileStore- Parameters:
content- the content- Returns:
- the id of the stored content, or null when the content could not be stored and must stay in the session
-
load
Loads the content of an uploaded file- Specified by:
loadin interfaceIUploadedFileStore- Parameters:
strId- the id given byIUploadedFileStore.store(byte[])- Returns:
- the content, or null when it is no longer stored
-
delete
Removes the content of an uploaded file- Specified by:
deletein interfaceIUploadedFileStore- Parameters:
strId- the id given byIUploadedFileStore.store(byte[])
-