Package org.apache.commons.vfs.cache
Class SoftRefFilesCache
- java.lang.Object
-
- org.apache.commons.vfs.provider.AbstractVfsComponent
-
- org.apache.commons.vfs.cache.AbstractFilesCache
-
- org.apache.commons.vfs.cache.SoftRefFilesCache
-
- All Implemented Interfaces:
FilesCache
,VfsComponent
- Direct Known Subclasses:
WeakRefFilesCache
public class SoftRefFilesCache extends AbstractFilesCache
This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the vm needs memory - every softly reachable file will be discarded.- Version:
- $Revision: 484648 $ $Date: 2005-09-30 09:02:41 +0200 (Fr, 30 Sep 2005) $
- Author:
- Mario Ivankovits
- See Also:
SoftReference
-
-
Constructor Summary
Constructors Constructor Description SoftRefFilesCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(FileSystem filesystem)
purge the entries corresponding to the filesystemvoid
close()
Closes the provider.protected java.lang.ref.Reference
createReference(FileObject file, java.lang.ref.ReferenceQueue refqueue)
FileObject
getFile(FileSystem filesystem, FileName name)
retrieve a file from the cache by its nameprotected java.util.Map
getOrCreateFilesystemCache(FileSystem filesystem)
void
putFile(FileObject file)
add a fileobject to the cachevoid
removeFile(FileSystem filesystem, FileName name)
removes a file from cachevoid
touchFile(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:FilesCache
add a fileobject to the cache- Parameters:
file
- the file
-
createReference
protected java.lang.ref.Reference createReference(FileObject file, java.lang.ref.ReferenceQueue refqueue)
-
getFile
public FileObject getFile(FileSystem filesystem, FileName name)
Description copied from interface:FilesCache
retrieve 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:FilesCache
purge the entries corresponding to the filesystem
-
close
public void close()
Description copied from class:AbstractVfsComponent
Closes the provider. This implementation does nothing.- Specified by:
close
in interfaceFilesCache
- Specified by:
close
in interfaceVfsComponent
- Overrides:
close
in classAbstractVfsComponent
-
removeFile
public void removeFile(FileSystem filesystem, FileName name)
Description copied from interface:FilesCache
removes a file from cache- Parameters:
filesystem
- filesystemname
- filename
-
touchFile
public void touchFile(FileObject file)
-
getOrCreateFilesystemCache
protected java.util.Map getOrCreateFilesystemCache(FileSystem filesystem)
-
-