Package org.apache.commons.vfs.cache
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
public class LRUFilesCache extends AbstractFilesCache
This implementation caches every file usingLRUMap.
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 Constructor Description LRUFilesCache()Default constructor.LRUFilesCache(int lruSize)Set the desired LRU size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear(FileSystem filesystem)purge the entries corresponding to the filesystemvoidclose()Closes the provider.FileObjectgetFile(FileSystem filesystem, FileName name)retrieve a file from the cache by its nameprotected java.util.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 org.apache.commons.vfs.provider.AbstractVfsComponent
getContext, getLogger, init, setContext, setLogger
-
-
-
-
Method Detail
-
putFile
public void putFile(FileObject file)
Description copied from interface:FilesCacheadd a fileobject to the cache- Parameters:
file- the file
-
getFile
public FileObject getFile(FileSystem filesystem, FileName name)
Description copied from interface:FilesCacheretrieve a file from the cache by its namename- the name- Returns:
- the fileobject or null if file is not cached
-
clear
public void clear(FileSystem filesystem)
Description copied from interface:FilesCachepurge the entries corresponding to the filesystem
-
getOrCreateFilesystemCache
protected java.util.Map getOrCreateFilesystemCache(FileSystem filesystem)
-
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
public void removeFile(FileSystem filesystem, FileName name)
Description copied from interface:FilesCacheremoves a file from cache- Parameters:
filesystem- filesystemname- filename
-
touchFile
public void touchFile(FileObject file)
-
-