org.openjena.atlas.lib.cache
Class CacheStatsSimple<Key,Value>

java.lang.Object
  extended by org.openjena.atlas.lib.cache.CacheWrapper<Key,Value>
      extended by org.openjena.atlas.lib.cache.CacheStatsSimple<Key,Value>
All Implemented Interfaces:
Cache<Key,Value>, CacheStats<Key,Value>

public class CacheStatsSimple<Key,Value>
extends CacheWrapper<Key,Value>
implements CacheStats<Key,Value>

Collect statistics for a cache - this class is not thread safe (@see{CacheStatsAtomic})


Constructor Summary
CacheStatsSimple(Cache<Key,Value> cache)
           
 
Method Summary
 void clear()
           
 Value get(Key key)
          Get from cache - or return null.
 long getCacheEjects()
           
 long getCacheEntries()
           
 long getCacheHits()
           
 long getCacheMisses()
           
 Value put(Key key, Value value)
          Insert into from cache and return old value (or null if none)
 boolean remove(Key key)
          Remove from cache - return true if key referenced an entry
 void setDropHandler(ActionKeyValue<Key,Value> dropHandler)
          Register a callback - called when an object is dropped from the cache (optional operation)
 
Methods inherited from class org.openjena.atlas.lib.cache.CacheWrapper
containsKey, isEmpty, keys, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openjena.atlas.lib.Cache
containsKey, isEmpty, keys, size
 

Constructor Detail

CacheStatsSimple

public CacheStatsSimple(Cache<Key,Value> cache)
Method Detail

get

public Value get(Key key)
Description copied from interface: Cache
Get from cache - or return null. Implementations should state whether they are thread-safe or not.

Specified by:
get in interface Cache<Key,Value>
Overrides:
get in class CacheWrapper<Key,Value>

put

public Value put(Key key,
                 Value value)
Description copied from interface: Cache
Insert into from cache and return old value (or null if none)

Specified by:
put in interface Cache<Key,Value>
Overrides:
put in class CacheWrapper<Key,Value>

remove

public boolean remove(Key key)
Description copied from interface: Cache
Remove from cache - return true if key referenced an entry

Specified by:
remove in interface Cache<Key,Value>
Overrides:
remove in class CacheWrapper<Key,Value>

clear

public void clear()
Specified by:
clear in interface Cache<Key,Value>
Overrides:
clear in class CacheWrapper<Key,Value>

setDropHandler

public void setDropHandler(ActionKeyValue<Key,Value> dropHandler)
Description copied from interface: Cache
Register a callback - called when an object is dropped from the cache (optional operation)

Specified by:
setDropHandler in interface Cache<Key,Value>
Overrides:
setDropHandler in class CacheWrapper<Key,Value>

getCacheEntries

public final long getCacheEntries()
Specified by:
getCacheEntries in interface CacheStats<Key,Value>

getCacheHits

public final long getCacheHits()
Specified by:
getCacheHits in interface CacheStats<Key,Value>

getCacheMisses

public final long getCacheMisses()
Specified by:
getCacheMisses in interface CacheStats<Key,Value>

getCacheEjects

public final long getCacheEjects()
Specified by:
getCacheEjects in interface CacheStats<Key,Value>


Licenced under the Apache License, Version 2.0