public class ResourceCache extends Object
| Modifier and Type | Field and Description | 
|---|---|
| protected long | accessCountNumber of accesses to the cache. | 
| protected CacheEntry[] | cacheCache. | 
| protected int | cacheMaxSizeMax size of resources which will have their content cached. | 
| protected int | cacheSizeCurrent cache size in KB. | 
| protected long | desiredEntryAccessRatioEntry hit ratio at which an entry will never be removed from the cache. | 
| protected long | hitsCountNumber of cache hits. | 
| protected int | maxAllocateIterationsMax amount of removals during a make space. | 
| protected HashMap<String,CacheEntry> | notFoundCacheNot found cache. | 
| protected Random | randomRandom generator used to determine elements to free. | 
| protected int | spareNotFoundEntriesSpare amount of not found entries. | 
| Constructor and Description | 
|---|
| ResourceCache() | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | allocate(int space) | 
| long | getAccessCount()Return the access count. | 
| int | getCacheMaxSize()Return the maximum size of the cache in KB. | 
| int | getCacheSize()Return the current cache size in KB. | 
| long | getDesiredEntryAccessRatio()Deprecated. 
 - unused | 
| long | getHitsCount()Return the number of cache hits. | 
| int | getMaxAllocateIterations()Deprecated. 
 - unused | 
| int | getSpareNotFoundEntries()Deprecated. 
 - unused | 
| void | load(CacheEntry entry) | 
| CacheEntry | lookup(String name) | 
| void | setCacheMaxSize(int cacheMaxSize)Set the maximum size of the cache in KB. | 
| void | setDesiredEntryAccessRatio(long desiredEntryAccessRatio)Deprecated. 
 - unused | 
| void | setMaxAllocateIterations(int maxAllocateIterations)Deprecated. 
 - unused | 
| void | setSpareNotFoundEntries(int spareNotFoundEntries)Deprecated. 
 - unused | 
| boolean | unload(String name) | 
protected Random random
protected CacheEntry[] cache
protected HashMap<String,CacheEntry> notFoundCache
protected int cacheMaxSize
protected int maxAllocateIterations
protected long desiredEntryAccessRatio
protected int spareNotFoundEntries
protected int cacheSize
protected long accessCount
protected long hitsCount
public long getAccessCount()
public int getCacheMaxSize()
public void setCacheMaxSize(int cacheMaxSize)
public int getCacheSize()
@Deprecated public long getDesiredEntryAccessRatio()
@Deprecated public void setDesiredEntryAccessRatio(long desiredEntryAccessRatio)
public long getHitsCount()
@Deprecated public int getMaxAllocateIterations()
@Deprecated public void setMaxAllocateIterations(int maxAllocateIterations)
@Deprecated public int getSpareNotFoundEntries()
@Deprecated public void setSpareNotFoundEntries(int spareNotFoundEntries)
public boolean allocate(int space)
public CacheEntry lookup(String name)
public void load(CacheEntry entry)
public boolean unload(String name)
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.