Interface CockpitResourceCache
-
- All Superinterfaces:
Resettable
- All Known Implementing Classes:
DefaultCockpitResourceCache
public interface CockpitResourceCache extends Resettable
Cache for the WidgetResourceLoader
-
-
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.longgetAverageEntrySize()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.longgetSize()Returns the size (in bytes) of all entries in the cache.voidreset()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:
resetin interfaceResettable
-
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.
-
-