public class CacheMetrics extends CacheWrapper
Modifier and Type | Field and Description |
---|---|
protected String |
INVALIDATE_ALL_NAME |
protected com.codahale.metrics.Counter |
invalidation |
protected com.codahale.metrics.Counter |
read |
protected com.codahale.metrics.Counter |
read_hit |
protected String |
READ_HIT_NAME |
protected com.codahale.metrics.RatioGauge |
read_hit_ratio |
protected String |
READ_HIT_RATIO_NAME |
protected com.codahale.metrics.Counter |
read_miss |
protected String |
READ_MISS_NAME |
protected String |
READ_NAME |
protected com.codahale.metrics.MetricRegistry |
registry |
protected com.codahale.metrics.Gauge<Long> |
size |
protected String |
SIZE_NAME |
protected com.codahale.metrics.Counter |
write |
protected String |
WRITE_NAME |
cache
Constructor and Description |
---|
CacheMetrics(Cache cache) |
Modifier and Type | Method and Description |
---|---|
Serializable |
get(String key)
Get method to retrieve value from cache Must not raise exception if the key is null, but return null
|
long |
getSize()
Return this cache size
|
void |
invalidate(String key)
Invalidate the given key
|
void |
invalidateAll()
Invalidate all key-value stored in the cache
|
protected String |
nameOf(String name) |
protected void |
onStop() |
void |
put(String key,
Serializable value)
Put method to store a
Serializable value |
getName, hasEntry, keySet, stop
protected final com.codahale.metrics.MetricRegistry registry
protected final com.codahale.metrics.Counter read
protected final com.codahale.metrics.Counter read_hit
protected final com.codahale.metrics.Counter read_miss
protected final com.codahale.metrics.RatioGauge read_hit_ratio
protected final com.codahale.metrics.Counter write
protected final com.codahale.metrics.Counter invalidation
protected final String READ_HIT_NAME
protected final String READ_HIT_RATIO_NAME
protected final String READ_MISS_NAME
protected final String WRITE_NAME
protected final String INVALIDATE_ALL_NAME
public CacheMetrics(Cache cache)
protected void onStop()
onStop
in class CacheWrapper
public Serializable get(String key)
Cache
get
in interface Cache
get
in class CacheWrapper
key
- the string keySerializable
value, return null if the key does not exist or if the key is nullpublic void put(String key, Serializable value)
Cache
Serializable
valueput
in interface Cache
put
in class CacheWrapper
key
- the string key, if null, the value will not be storedvalue
- the value to store, if null, the value will not be storedpublic void invalidate(String key)
Cache
invalidate
in interface Cache
invalidate
in class CacheWrapper
public void invalidateAll()
Cache
invalidateAll
in interface Cache
invalidateAll
in class CacheWrapper
Copyright © 2017 Nuxeo. All rights reserved.