Package org.apache.commons.vfs2.cache
Class SoftRefFilesCache
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.cache.AbstractFilesCache
org.apache.commons.vfs2.cache.SoftRefFilesCache
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- FilesCache,- VfsComponent
- Direct Known Subclasses:
- WeakRefFilesCache
This implementation caches every file as long as it is strongly reachable by the JVM. As soon as the JVM needs
 memory - every softly reachable file will be discarded.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear(FileSystem fileSystem) Purges the entries corresponding to the FileSystem.voidclose()Closes the provider.protected Reference<FileObject> createReference(FileObject file, ReferenceQueue<FileObject> referenceQueue) Constructs a new Reference.getFile(FileSystem fileSystem, FileName fileName) Retrieves a FileObject from the cache by name.protected Map<FileName, Reference<FileObject>> getOrCreateFilesystemCache(FileSystem fileSystem) Gets or creates a new Map.voidputFile(FileObject fileObject) Adds a FileObject to the cache.booleanputFileIfAbsent(FileObject fileObject) Adds a FileObject to the cache if it isn't already present.voidremoveFile(FileSystem fileSystem, FileName fileName) Removes a file from cache.toString()Methods inherited from class org.apache.commons.vfs2.cache.AbstractFilesCachetouchFileMethods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponentgetContext, getLogger, init, setContext, setLogger
- 
Constructor Details- 
SoftRefFilesCachepublic SoftRefFilesCache()Constructs a new instance.
 
- 
- 
Method Details- 
clearDescription copied from interface:FilesCachePurges the entries corresponding to the FileSystem.- Parameters:
- fileSystem- The FileSystem.
 
- 
closeDescription copied from class:AbstractVfsComponentCloses the provider. This implementation does nothing.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- FilesCache
- Specified by:
- closein interface- VfsComponent
- Overrides:
- closein class- AbstractVfsComponent
 
- 
createReferenceprotected Reference<FileObject> createReference(FileObject file, ReferenceQueue<FileObject> referenceQueue) Constructs a new Reference.- Parameters:
- file- a file object.
- referenceQueue- a ReferenceQueue.
- Returns:
- a new Reference on the given input.
 
- 
getFileDescription copied from interface:FilesCacheRetrieves a FileObject from the cache by name.- Parameters:
- fileSystem- The FileSystem.
- fileName- the name
- Returns:
- the file object or null if file is not cached
 
- 
getOrCreateFilesystemCacheGets or creates a new Map.- Parameters:
- fileSystem- the key.
- Returns:
- an existing or new Map.
 
- 
putFileDescription copied from interface:FilesCacheAdds a FileObject to the cache.- Parameters:
- fileObject- the file
 
- 
putFileIfAbsentDescription copied from interface:FilesCacheAdds a FileObject to the cache if it isn't already present.- Parameters:
- fileObject- the file
- Returns:
- true if the file was stored, false otherwise.
 
- 
removeFileDescription copied from interface:FilesCacheRemoves a file from cache.- Parameters:
- fileSystem- file system
- fileName- file name
 
- 
toString
 
-