Package org.gorpipe.gor.clients
Class LocalFileCacheClient
java.lang.Object
org.gorpipe.gor.clients.LocalFileCacheClient
- All Implemented Interfaces:
java.lang.AutoCloseable,org.gorpipe.client.FileCache
- Direct Known Subclasses:
NoCacheFileCacheClient
public class LocalFileCacheClient
extends java.lang.Object
implements org.gorpipe.client.FileCache
Local implementation of file cache client working directly against the file system. This can be used for non server
implementations of file cache.
-
Constructor Summary
Constructors Constructor Description LocalFileCacheClient(java.nio.file.Path rootPath)LocalFileCacheClient(java.nio.file.Path rootPath, boolean useSubFolders, int subFolderSize)Constructs an instance of local file cache. -
Method Summary
Modifier and Type Method Description voidclose()java.lang.StringlookupFile(java.lang.String fingerprint)java.lang.String[]multiLookup(java.lang.String[] fingerprints, boolean defer)java.lang.Stringstore(java.nio.file.Path from, java.lang.String fingerprint, java.lang.String ext, long cost)java.lang.StringstoreSibling(java.nio.file.Path path, java.lang.String fingerprint)java.lang.StringstoreWithSpecificCacheFilename(java.nio.file.Path path, java.lang.String fingerprint, java.lang.String cacheFilename, long cost)java.lang.StringtempLocation(java.lang.String fingerprint, java.lang.String ext)
-
Constructor Details
-
LocalFileCacheClient
public LocalFileCacheClient(java.nio.file.Path rootPath, boolean useSubFolders, int subFolderSize)Constructs an instance of local file cache. If sub folders are used the first subFolderSize letters of the fingerprint are used to create a sub folder storing the result file.- Parameters:
rootPath- File cache locationuseSubFolders- Inserts sub folders for fingerprints.subFolderSize- Insers sub folders for fingerprints.
-
LocalFileCacheClient
public LocalFileCacheClient(java.nio.file.Path rootPath)
-
-
Method Details
-
lookupFile
public java.lang.String lookupFile(java.lang.String fingerprint)- Specified by:
lookupFilein interfaceorg.gorpipe.client.FileCache
-
store
public java.lang.String store(java.nio.file.Path from, java.lang.String fingerprint, java.lang.String ext, long cost)- Specified by:
storein interfaceorg.gorpipe.client.FileCache
-
storeWithSpecificCacheFilename
public java.lang.String storeWithSpecificCacheFilename(java.nio.file.Path path, java.lang.String fingerprint, java.lang.String cacheFilename, long cost)- Specified by:
storeWithSpecificCacheFilenamein interfaceorg.gorpipe.client.FileCache
-
storeSibling
public java.lang.String storeSibling(java.nio.file.Path path, java.lang.String fingerprint)- Specified by:
storeSiblingin interfaceorg.gorpipe.client.FileCache
-
tempLocation
public java.lang.String tempLocation(java.lang.String fingerprint, java.lang.String ext)- Specified by:
tempLocationin interfaceorg.gorpipe.client.FileCache
-
multiLookup
public java.lang.String[] multiLookup(java.lang.String[] fingerprints, boolean defer)- Specified by:
multiLookupin interfaceorg.gorpipe.client.FileCache
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-