public class LocalCache extends Object
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getData(Identifier key)
Retrieve an array of bytes from the cache, throwing NotCached if the object
with the Identifier key is not in the cache.
|
int |
getHits()
Returns the cache hits, the number of times that objects are requested
and found in the cache since the last time that counters were reset.
|
int |
getMisses()
Returns the cache misses, the number of times that objects are requested
but are not found in the cache since the last time that counters were reset.
|
SystemMetadata |
getSystemMetadata(Identifier key)
Retrieve a SystemMetadata from the cache, throwing NotCached if the system metadata
for the Identifier key is not in the cache.
|
static LocalCache |
instance()
Get the singleton instance of the LocalCache that can be used to perform
cache operations.
|
void |
putData(Identifier key,
byte[] data)
Put an immutable data object into the local cache by serializing it as
a byte array, indexed by its unique Identifier.
|
void |
putSystemMetadata(Identifier key,
SystemMetadata sysmeta)
Put a mutable SystemMetadata object into the local cache, indexed by the
unique Identifier of the object that this system metadata describes.
|
void |
resetCounters()
Reset the cache hit/miss counters to 0.
|
public static LocalCache instance()
public void putData(Identifier key, byte[] data)
key - the Identifier used to index the objectdata - to be cachedpublic byte[] getData(Identifier key) throws NotCached
key - the Identifier of the cached object to retrieveNotCachedpublic void putSystemMetadata(Identifier key, SystemMetadata sysmeta)
key - the Identifier used to index the objectSystemMetadata - to be cachedpublic SystemMetadata getSystemMetadata(Identifier key) throws NotCached
key - the Identifier of the cached SystemMetadata to retrieveNotCachedpublic int getHits()
public int getMisses()
public void resetCounters()
Copyright © 2014. All Rights Reserved.