|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.core.state.CacheManager
public class CacheManager
This class manages the size of the caches used in Jackrabbit. The combined size of all caches must be limited to avoid out of memory problems. The available memory is dynamically distributed across the caches each second. This class tries to calculates the best cache sizes by comparing the access counts of each cache, and the used memory. The idea is, the more a cache is accessed, the more memory it should get, while the cache should not shrink too quickly. A minimum and maximum size per cache is defined as well. After distributing the memory in this way, there might be some unused memory (if one or more caches did not use some of the allocated memory). This unused memory is distributed evenly across the full caches.
Nested Class Summary | |
---|---|
static class |
CacheManager.CacheInfo
Internal copy of the cache information. |
Field Summary |
---|
Fields inherited from interface org.apache.jackrabbit.core.state.CacheAccessListener |
---|
ACCESS_INTERVAL |
Constructor Summary | |
---|---|
CacheManager()
|
Method Summary | |
---|---|
void |
add(Cache cache)
Add a new cache to the list. |
void |
cacheAccessed()
After one of the caches is accessed a number of times, this method is called. |
void |
disposeCache(Cache cache)
Called after the cache is no longer used. |
long |
getMaxMemory()
|
long |
getMaxMemoryPerCache()
|
long |
getMinMemoryPerCache()
|
long |
getMinResizeInterval()
|
void |
remove(Cache cache)
Remove a cache. |
void |
setMaxMemory(long maxMemory)
|
void |
setMaxMemoryPerCache(long maxMemoryPerCache)
|
void |
setMinMemoryPerCache(long minMemoryPerCache)
|
void |
setMinResizeInterval(long minResizeInterval)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CacheManager()
Method Detail |
---|
public long getMaxMemory()
public void setMaxMemory(long maxMemory)
public long getMaxMemoryPerCache()
public void setMaxMemoryPerCache(long maxMemoryPerCache)
public long getMinMemoryPerCache()
public void setMinMemoryPerCache(long minMemoryPerCache)
public long getMinResizeInterval()
public void setMinResizeInterval(long minResizeInterval)
public void cacheAccessed()
cacheAccessed
in interface CacheAccessListener
public void add(Cache cache)
cache
- the cache to addpublic void remove(Cache cache)
cache
- the cache to removepublic void disposeCache(Cache cache)
CacheAccessListener
disposeCache
in interface CacheAccessListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |