org.apache.jackrabbit.core.cache
Interface Cache

All Known Implementing Classes:
AbstractCache, ConcurrentCache

public interface Cache

A Cache object A cache must call CacheManager.getInstance().add(this) to take part in the dynamic memory distribution.


Method Summary
 long getAccessCount()
          Get the number of accesses (get or set) until resetAccessCount was called.
 String getCacheInfoAsString()
          Gathers the stats of the cache for logging.
 long getElementCount()
          Get the number of elements/objects in the cache.
 long getMaxMemorySize()
          Get the current limit.
 long getMemoryUsed()
          Get the amount of used memory.
 long getMissCount()
          Get the number of cache misses.
 long getTotalAccessCount()
          Get the total number of cache accesses.
 void resetAccessCount()
          Reset the access counter.
 void resetMissCount()
          Reset the cache miss counter.
 void setAccessListener(CacheAccessListener listener)
          Add a listener to this cache that is informed after a number of accesses.
 void setMaxMemorySize(long size)
          Set the new memory limit.
 

Method Detail

setMaxMemorySize

void setMaxMemorySize(long size)
Set the new memory limit.

Parameters:
size - the size in bytes

getMaxMemorySize

long getMaxMemorySize()
Get the current limit.

Returns:
the size in bytes

getMemoryUsed

long getMemoryUsed()
Get the amount of used memory.

Returns:
the size in bytes

getAccessCount

long getAccessCount()
Get the number of accesses (get or set) until resetAccessCount was called.

Returns:
the count

resetAccessCount

void resetAccessCount()
Reset the access counter.


getTotalAccessCount

long getTotalAccessCount()
Get the total number of cache accesses.

Returns:
the number of hits

getMissCount

long getMissCount()
Get the number of cache misses.

Returns:
the number of misses

resetMissCount

void resetMissCount()
Reset the cache miss counter.


getElementCount

long getElementCount()
Get the number of elements/objects in the cache.

Returns:
the number of elements

setAccessListener

void setAccessListener(CacheAccessListener listener)
Add a listener to this cache that is informed after a number of accesses.


getCacheInfoAsString

String getCacheInfoAsString()
Gathers the stats of the cache for logging.



Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.