Class MemoryMappedFileCache

Object
MemoryMappedFileCache
All Implemented Interfaces:
FileCacheIF

@ThreadSafe public class MemoryMappedFileCache extends Object implements FileCacheIF
  • Field Details

    • log

      protected static final Logger log
    • cacheLog

      protected static final Logger cacheLog
    • name

      protected String name
    • softLimit

      protected final int softLimit
    • minElements

      protected final int minElements
    • hardLimit

      protected final int hardLimit
    • period

      protected final long period
    • hasScheduled

      protected final AtomicBoolean hasScheduled
    • cache

      protected final ConcurrentHashMap<Object,MemoryMappedFileCache.CacheElement> cache
    • files

      protected final ConcurrentHashMap<FileCacheable,MemoryMappedFileCache.CacheElement.CacheFile> files
    • cleanups

      protected final AtomicInteger cleanups
    • hits

      protected final AtomicInteger hits
    • miss

      protected final AtomicInteger miss
    • track

      protected ConcurrentHashMap<Object,MemoryMappedFileCache.CacheTracking> track
    • trackAll

      protected boolean trackAll
  • Constructor Details

    • MemoryMappedFileCache

      public MemoryMappedFileCache(int minElementsInMemory, int maxElementsInMemory, int period)
    • MemoryMappedFileCache

      public MemoryMappedFileCache(int minElementsInMemory, int softLimit, int hardLimit, int period)
    • MemoryMappedFileCache

      public MemoryMappedFileCache(String name, int minElementsInMemory, int softLimit, int hardLimit, int period)
  • Method Details

    • shutdown

      public static void shutdown()
    • addRaf

      protected void addRaf(String uriString, MemoryMappedRandomAccessFile mmraf)
    • disable

      public void disable()
      Specified by:
      disable in interface FileCacheIF
    • enable

      public void enable()
      Specified by:
      enable in interface FileCacheIF
    • acquire

      public FileCacheable acquire(FileFactory factory, DatasetUrl durl) throws IOException
      Specified by:
      acquire in interface FileCacheIF
      Throws:
      IOException
    • acquire

      public FileCacheable acquire(FileFactory factory, Object hashKey, DatasetUrl location, int buffer_size, CancelTask cancelTask, Object spiObject) throws IOException
      Specified by:
      acquire in interface FileCacheIF
      Throws:
      IOException
    • eject

      public void eject(Object hashKey)
      Specified by:
      eject in interface FileCacheIF
    • release

      public boolean release(FileCacheable ncfile) throws IOException
      Specified by:
      release in interface FileCacheIF
      Throws:
      IOException
    • clearCache

      public void clearCache(boolean force)
      Specified by:
      clearCache in interface FileCacheIF
    • showCache

      public void showCache(Formatter format)
      Specified by:
      showCache in interface FileCacheIF
    • showCache

      public List<String> showCache()
      Specified by:
      showCache in interface FileCacheIF
    • showStats

      public void showStats(Formatter format)
      Specified by:
      showStats in interface FileCacheIF
    • showTracking

      public void showTracking(Formatter format)
      Specified by:
      showTracking in interface FileCacheIF
    • resetTracking

      public void resetTracking()
      Specified by:
      resetTracking in interface FileCacheIF