Class LRUFilesCache

  • All Implemented Interfaces:
    FilesCache, VfsComponent

    public class LRUFilesCache
    extends AbstractFilesCache
    This implementation caches every file using LRUMap.

    The default constructor uses a LRU size of 100 per filesystem.

    • Constructor Detail

      • 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 Detail

      • putFile

        public void putFile​(FileObject file)
        Description copied from interface: FilesCache
        Adds a FileObject to the cache.
        Parameters:
        file - the file
      • putFileIfAbsent

        public boolean putFileIfAbsent​(FileObject file)
        Description copied from interface: FilesCache
        Adds a FileObject to the cache if it isn't already present.
        Parameters:
        file - the file
        Returns:
        true if the file was stored, false otherwise.
      • getFile

        public FileObject getFile​(FileSystem filesystem,
                                  FileName name)
        Description copied from interface: FilesCache
        Retrieves a FileObject from the cache by name.
        Parameters:
        filesystem - The FileSystem.
        name - the name
        Returns:
        the fileobject or null if file is not cached
      • clear

        public void clear​(FileSystem filesystem)
        Description copied from interface: FilesCache
        Purges the entries corresponding to the FileSystem.
        Parameters:
        filesystem - The FileSystem.
      • removeFile

        public void removeFile​(FileSystem filesystem,
                               FileName name)
        Description copied from interface: FilesCache
        Removes a file from cache.
        Parameters:
        filesystem - filesystem
        name - filename