Class LRUFilesCache
java.lang.Object
org.apache.commons.vfs.provider.AbstractVfsComponent
org.apache.commons.vfs.cache.AbstractFilesCache
org.apache.commons.vfs.cache.LRUFilesCache
- All Implemented Interfaces:
FilesCache, VfsComponent
This implementation caches every file using
The default constructor uses a LRU size of 100 per filesystem.
LRUMap.The default constructor uses a LRU size of 100 per filesystem.
- Version:
- $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov 2006) $
- Author:
- Mario Ivankovits
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear(FileSystem filesystem) purge the entries corresponding to the filesystemvoidclose()Closes the provider.getFile(FileSystem filesystem, FileName name) retrieve a file from the cache by its nameprotected MapgetOrCreateFilesystemCache(FileSystem filesystem) voidputFile(FileObject file) add a fileobject to the cachevoidremoveFile(FileSystem filesystem, FileName name) removes a file from cachevoidtouchFile(FileObject file) Methods inherited from class AbstractVfsComponent
getContext, getLogger, init, setContext, setLogger
-
Constructor Details
-
LRUFilesCache
public LRUFilesCache()Default constructor. Uses a LRU size of 100 per filesystem. -
LRUFilesCache
public LRUFilesCache(int lruSize) Set the desired LRU size.- Parameters:
lruSize- the LRU size
-
-
Method Details
-
putFile
Description copied from interface:FilesCacheadd a fileobject to the cache- Parameters:
file- the file
-
getFile
Description copied from interface:FilesCacheretrieve a file from the cache by its name- Parameters:
name- the name- Returns:
- the fileobject or null if file is not cached
-
clear
Description copied from interface:FilesCachepurge the entries corresponding to the filesystem -
getOrCreateFilesystemCache
-
close
public void close()Description copied from class:AbstractVfsComponentCloses the provider. This implementation does nothing.- Specified by:
closein interfaceFilesCache- Specified by:
closein interfaceVfsComponent- Overrides:
closein classAbstractVfsComponent
-
removeFile
Description copied from interface:FilesCacheremoves a file from cache- Parameters:
filesystem- filesystemname- filename
-
touchFile
-