Class AbstractPersistentCache

    • Constructor Detail

      • AbstractPersistentCache

        public AbstractPersistentCache()
    • Method Detail

      • readSegment

        public Buffer readSegment​(long msb,
                                  long lsb,
                                  @NotNull
                                  @NotNull Callable<Buffer> loader)
        Description copied from interface: PersistentCache
        Reads the segment from cache.
        Specified by:
        readSegment in interface PersistentCache
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        loader - in case of cache miss, with loader.call() missing element will be retrieved
        Returns:
        byte buffer containing the segment data or null if the segment doesn't exist
      • readSegmentInternal

        protected abstract Buffer readSegmentInternal​(long msb,
                                                      long lsb)
        Reads the segment from the cache. If segment is not found, this method does not query next cache that was set with linkWith(AbstractPersistentCache)
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        Returns:
        byte buffer containing the segment data or null if the segment doesn't exist
      • recordCacheLoadTimeInternal

        protected final void recordCacheLoadTimeInternal​(long loadTime,
                                                         boolean successful)
        Records time spent to load data from external source, after cache miss.
        Parameters:
        loadTime - load time in nanoseconds
        successful - indicates whether loading of the segment into cache was successful
      • getCacheStats

        @NotNull
        public @NotNull AbstractCacheStats getCacheStats()
        Returns:
        Statistics for this cache.
      • getWritesPending

        public int getWritesPending()