Package org.apache.commons.vfs2.cache
Class WeakRefFilesCache
- java.lang.Object
-
- org.apache.commons.vfs2.provider.AbstractVfsComponent
-
- org.apache.commons.vfs2.cache.AbstractFilesCache
-
- org.apache.commons.vfs2.cache.SoftRefFilesCache
-
- org.apache.commons.vfs2.cache.WeakRefFilesCache
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,FilesCache
,VfsComponent
public class WeakRefFilesCache extends SoftRefFilesCache
This implementation caches every file as long as it is strongly reachable by the Java vm. As soon as the object is no longer reachable it will be discarded. In contrast to the SoftRefFilesCache this implementation might free resources faster as it doesn't wait until a memory limitation.- See Also:
WeakReference
-
-
Constructor Summary
Constructors Constructor Description WeakRefFilesCache()
Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ref.Reference<FileObject>
createReference(FileObject file, java.lang.ref.ReferenceQueue<FileObject> refqueue)
Constructs a new Reference.-
Methods inherited from class org.apache.commons.vfs2.cache.SoftRefFilesCache
clear, close, getFile, getOrCreateFilesystemCache, putFile, putFileIfAbsent, removeFile, toString
-
Methods inherited from class org.apache.commons.vfs2.cache.AbstractFilesCache
touchFile
-
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponent
getContext, getLogger, init, setContext, setLogger
-
-
-
-
Constructor Detail
-
WeakRefFilesCache
public WeakRefFilesCache()
Constructs a new instance.
-
-
Method Detail
-
createReference
protected java.lang.ref.Reference<FileObject> createReference(FileObject file, java.lang.ref.ReferenceQueue<FileObject> refqueue)
Description copied from class:SoftRefFilesCache
Constructs a new Reference.- Overrides:
createReference
in classSoftRefFilesCache
- Parameters:
file
- a file object.refqueue
- a ReferenceQueue.- Returns:
- a new Reference on the given input.
-
-