org.apache.naming.resources
Class ResourceCache
java.lang.Object
org.apache.naming.resources.ResourceCache
public class ResourceCache
extends java.lang.Object
Implements a special purpose cache.
Version:
- Remy Maucherat
accessCount
protected long accessCount
Number of accesses to the cache.
cache
protected CacheEntry[] cache
Cache.
Path -> Cache entry.
cacheMaxSize
protected int cacheMaxSize
Max size of resources which will have their content cached.
cacheSize
protected int cacheSize
Current cache size in KB.
desiredEntryAccessRatio
protected long desiredEntryAccessRatio
Entry hit ratio at which an entry will never be removed from the cache.
Compared with entry.access / hitsCount
hitsCount
protected long hitsCount
Number of cache hits.
maxAllocateIterations
protected int maxAllocateIterations
Max amount of removals during a make space.
notFoundCache
protected HashMap notFoundCache
Not found cache.
spareNotFoundEntries
protected int spareNotFoundEntries
Spare amount of not found entries.
ResourceCache
public ResourceCache()
allocate
public boolean allocate(int space)
getAccessCount
public long getAccessCount()
Return the access count.
Note: Update is not synced, so the number may not be completely
accurate.
getCacheMaxSize
public int getCacheMaxSize()
Return the maximum size of the cache in KB.
getCacheSize
public int getCacheSize()
Return the current cache size in KB.
getDesiredEntryAccessRatio
public long getDesiredEntryAccessRatio()
Return desired entry access ratio.
getHitsCount
public long getHitsCount()
Return the number of cache hits.
Note: Update is not synced, so the number may not be completely
accurate.
getMaxAllocateIterations
public int getMaxAllocateIterations()
Return the maximum amount of iterations during a space allocation.
getSpareNotFoundEntries
public int getSpareNotFoundEntries()
Return the amount of spare not found entries.
setCacheMaxSize
public void setCacheMaxSize(int cacheMaxSize)
Set the maximum size of the cache in KB.
setDesiredEntryAccessRatio
public void setDesiredEntryAccessRatio(long desiredEntryAccessRatio)
Set the desired entry access ratio.
setMaxAllocateIterations
public void setMaxAllocateIterations(int maxAllocateIterations)
Set the maximum amount of iterations during a space allocation.
setSpareNotFoundEntries
public void setSpareNotFoundEntries(int spareNotFoundEntries)
Set the amount of spare not found entries.
unload
public boolean unload(String name)
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.