public class FileCacheProvider extends java.lang.Object implements CacheProvider
| Constructor and Description |
|---|
FileCacheProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Entirely clear the cache content
|
void |
definePaths()
Define the root path
|
<T> T |
get(java.lang.String key)
Getting an entry on the cache
|
java.nio.file.Path |
getCachePath(java.lang.String key)
Returns the path from the given key
|
java.util.List<java.lang.String> |
getKeys()
Returns all keys from a given cache
|
<T> void |
lockAndSet(java.lang.String key,
T entry)
Applies a lock to a cache's file
|
void |
parseConfig(java.io.BufferedReader br)
Parses the config file
|
void |
remove(java.lang.String key)
Removes an entry in the cache
|
<T> void |
set(java.lang.String key,
T entry)
Adding an entry to the cache
|
void |
setCacheFileEntry(java.io.File current,
java.nio.file.Path path)
Sets a file cache entry
|
void |
setExpiry(int expiry)
Reconfigure the expiry after
|
void |
shutdown()
No shutdown operation for this class
|
public void parseConfig(java.io.BufferedReader br)
throws java.io.IOException
br - java.io.IOExceptionpublic void definePaths()
public void setCacheFileEntry(java.io.File current,
java.nio.file.Path path)
current - path - public java.nio.file.Path getCachePath(java.lang.String key)
throws java.io.IOException
key - java.io.IOExceptionpublic <T> T get(java.lang.String key)
throws CacheException
CacheProviderget in interface CacheProviderT - cache entrykey - key of the cache entryCacheException - when there is cache issues getting by keypublic <T> void lockAndSet(java.lang.String key,
T entry)
throws CacheException
key - entry - CacheExceptionpublic <T> void set(java.lang.String key,
T entry)
throws CacheException
CacheProviderset in interface CacheProviderT - cache entrykey - key of the cache entryentry - cache entryCacheException - when there is cache issues setting an elementpublic void remove(java.lang.String key)
throws CacheException
CacheProviderremove in interface CacheProviderkey - key of the cache entryCacheException - when there is cache issues removing an entrypublic void clear()
CacheProviderclear in interface CacheProviderpublic void shutdown()
shutdown in interface CacheProviderpublic java.util.List<java.lang.String> getKeys()
CacheProvidergetKeys in interface CacheProviderpublic void setExpiry(int expiry)
CacheProvidersetExpiry in interface CacheProviderexpiry - cache time life in minutes