Interface CockpitResourceCache

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] addResourceToCache​(java.lang.String uuid, byte[] resource)
      Adds a chunk of bytes to the cache.
      long getAverageEntrySize()
      Returns the average size (in bytes) of all entries.
      java.util.Collection<java.lang.String> getKeys()
      Returns the keys for the current entries.
      byte[] getResourceAsBytes​(java.lang.String uuid)
      Gets the resource for the given key, if present in cache.
      long getSize()
      Returns the size (in bytes) of all entries in the cache.
      void reset()
      Removes all elements from the cache.
    • Method Detail

      • getResourceAsBytes

        byte[] getResourceAsBytes​(java.lang.String uuid)
        Gets the resource for the given key, if present in cache.
        Returns:
        The cached byte array, or null, if not in cache.
      • addResourceToCache

        byte[] addResourceToCache​(java.lang.String uuid,
                                  byte[] resource)
        Adds a chunk of bytes to the cache.
        Parameters:
        uuid - The unique key for the resource, usually an uri.
        resource - The resource to add as byte array.
        Returns:
        The passed resource, for convenience reasons.
      • reset

        void reset()
        Removes all elements from the cache.
        Specified by:
        reset in interface Resettable
      • getSize

        long getSize()
        Returns the size (in bytes) of all entries in the cache.
      • getAverageEntrySize

        long getAverageEntrySize()
        Returns the average size (in bytes) of all entries.
      • getKeys

        java.util.Collection<java.lang.String> getKeys()
        Returns the keys for the current entries.