public class LRUFilesCache extends AbstractFilesCache
LRUMap
.
The default constructor uses a LRU size of 100 per file system.
Constructor and Description |
---|
LRUFilesCache()
Default constructor.
|
LRUFilesCache(int lruSize)
Set the desired LRU size.
|
Modifier and Type | Method and Description |
---|---|
void |
clear(FileSystem filesystem)
Purges the entries corresponding to the FileSystem.
|
void |
close()
Closes the provider.
|
FileObject |
getFile(FileSystem filesystem,
FileName name)
Retrieves a FileObject from the cache by name.
|
protected Map<FileName,FileObject> |
getOrCreateFilesystemCache(FileSystem filesystem) |
void |
putFile(FileObject file)
Adds a FileObject to the cache.
|
boolean |
putFileIfAbsent(FileObject file)
Adds a FileObject to the cache if it isn't already present.
|
void |
removeFile(FileSystem filesystem,
FileName name)
Removes a file from cache.
|
void |
touchFile(FileObject file)
Default implementation is a NOOP.
|
getContext, getLogger, init, setContext, setLogger
public LRUFilesCache()
public LRUFilesCache(int lruSize)
lruSize
- the LRU sizepublic void putFile(FileObject file)
FilesCache
file
- the filepublic boolean putFileIfAbsent(FileObject file)
FilesCache
file
- the filepublic FileObject getFile(FileSystem filesystem, FileName name)
FilesCache
filesystem
- The FileSystem.name
- the namepublic void clear(FileSystem filesystem)
FilesCache
filesystem
- The FileSystem.protected Map<FileName,FileObject> getOrCreateFilesystemCache(FileSystem filesystem)
public void close()
AbstractVfsComponent
close
in interface Closeable
close
in interface AutoCloseable
close
in interface FilesCache
close
in interface VfsComponent
close
in class AbstractVfsComponent
public void removeFile(FileSystem filesystem, FileName name)
FilesCache
filesystem
- file systemname
- file namepublic void touchFile(FileObject file)
AbstractFilesCache
touchFile
in class AbstractFilesCache
file
- touch this file.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.