Interface PersistentCache

    • Method Detail

      • readSegment

        @Nullable
        @Nullable Buffer readSegment​(long msb,
                                     long lsb,
                                     @NotNull
                                     @NotNull Callable<Buffer> loader)
        Reads the segment from cache.
        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
      • containsSegment

        boolean containsSegment​(long msb,
                                long lsb)
        Check if the segment exists in the cache.
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        Returns:
        true if the segment exists
      • writeSegment

        void writeSegment​(long msb,
                          long lsb,
                          Buffer buffer)
        Writes the segment to the cache.
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        buffer - the byte buffer containing the segment data
      • cleanUp

        void cleanUp()
        Purges the cache entries according to the implementation policy (e.g. maximum cache size, maximum number of entries, etc.)