Package com.codingchili.core.files
Class CachedFileStore
java.lang.Object
com.codingchili.core.files.CachedFileStore
- All Implemented Interfaces:
FileStoreListener
Caches files from disk in memory and reloads them on change.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCachedFileStore(CoreContext context, CachedFileStoreSettings settings)
Maintain a CachedFileStore for each loaded directory. -
Method Summary
Modifier and TypeMethodDescriptionaddListener(FileStoreListener listener)
getFiles()
void
onFileModify(Path path)
Triggered when a file on the registered path has been modified or created.void
onFileRemove(Path path)
Triggered when a file on the registered path has been deleted.
-
Field Details
-
context
-
-
Constructor Details
-
CachedFileStore
Maintain a CachedFileStore for each loaded directory.- Parameters:
context
- the context requesting the feature.settings
- the settings to use for the CachedFileStore, if conflicting with any existing configuration for the given path the configuration is ignored.
-
-
Method Details
-
onFileModify
Description copied from interface:FileStoreListener
Triggered when a file on the registered path has been modified or created.- Specified by:
onFileModify
in interfaceFileStoreListener
- Parameters:
path
- the basedir-relative path to the file that was modified.
-
onFileRemove
Description copied from interface:FileStoreListener
Triggered when a file on the registered path has been deleted.- Specified by:
onFileRemove
in interfaceFileStoreListener
- Parameters:
path
- the basedir-relative path to the file that was modified.
-
getFiles
-
getFile
- Throws:
FileMissingException
-
addListener
- Parameters:
listener
- a modify/remove event listener.- Returns:
- fluent
-