Class CacheIndex


  • class CacheIndex
    extends java.lang.Object
    Index of the cached resources.

    This implementation uses a least recently accessed approach to evict resources when the total size of the cache exceeds the limit.

    • Method Detail

      • findEntry

        java.util.Optional<CacheIndexEntry> findEntry​(CacheKey key)
        Finds a single entry.
        Returns:
        the entry found or empty, never null.
      • findAndMarkAsAccessed

        java.util.Optional<CacheIndexEntry> findAndMarkAsAccessed​(CacheKey key)
        Finds a single entry and marks it as accessed.
        Returns:
        the entry found or empty, never null.
      • findAllEntries

        java.util.Set<CacheIndexEntry> findAllEntries​(java.net.URL resourceHref)
        Finds all entries matching the resource independent of their version.
        Returns:
        a set of all matching entries, never null.
      • findAllEntries

        java.util.Set<CacheIndexEntry> findAllEntries​(java.net.URL resourceHref,
                                                      VersionString versionString)
        Finds all entries matching the resource and version.
        Returns:
        a set of all matching entries, never null.
      • getAllEntries

        java.util.List<CacheIndexEntry> getAllEntries()
        Returns:
        all entries
      • createEntry

        CacheIndexEntry createEntry​(CacheKey key,
                                    java.lang.String entryId)
        Create a new entry.
        Returns:
        the newly created entry
      • removeEntry

        void removeEntry​(CacheKey key)
        Marks the entry for deletion
      • removeEntry

        void removeEntry​(CacheIndexEntry entry)
        Removes an entry from the index.
      • requestCompression

        void requestCompression()
      • clear

        void clear()
        Removes all entries.