| java.lang.Object org.w3c.www.protocol.http.cache.CacheGeneration
CacheGeneration | public class CacheGeneration implements LRUAble(Code) | | |
prev | protected LRUAble prev(Code) | | LRU management - previous entry.
|
addResource | public synchronized boolean addResource(CachedResource cr, long size, long oldsize)(Code) | | Adds this resource, if possible
cr, the candidate. size, the size of the candidate. a boolean, true if this resource has been cached |
clean | public void clean()(Code) | | Clean this generation.
|
collectSpace | public long collectSpace(long size, boolean check)(Code) | | will garbage collect up to "size" bytes in this generation.
WARNING: this is not synchronized, use with caution!
long the number of bytes to be collected check, a boolean, used to validate or not the resource beforedeleting them (ie: delete only invalid resources) a long, the number of bytes savedfrom disk afterward using delete. |
containsResource | public synchronized boolean containsResource(String url)(Code) | | Check if a resource has been cached in this generation
Parameters: url - the resource url a boolean |
copyInto | protected synchronized void copyInto(CacheGeneration gen)(Code) | | copy the content of the generation here
|
deleteGenerationFile | protected void deleteGenerationFile()(Code) | | delete the serialized resource file from the disk
|
deleteStored | public long deleteStored(CachedResource cr)(Code) | | Deletes a resource from the "to be deleted" vector
it updates also the number of bye stored in this generation
the number of bytes saved. |
emptyGeneration | protected long emptyGeneration()(Code) | | empty this generation
a long, the number of bytes saved |
getByteLimit | public long getByteLimit()(Code) | | Get the bytecount limit for this generation
a long, the maximum number of bytes |
getCRCount | public int getCRCount()(Code) | | Get the current number of resource loaded.
an long |
getCachedByteCount | public long getCachedByteCount()(Code) | | Give the acual occupation level of this generation
a long, the number of bytes of this generation |
getCachedResources | public Enumeration getCachedResources()(Code) | | Get the CachedResource of this generation (except the "to be
deleted" resources)
an Enumeration of CachedResource |
getDeletedResources | public Enumeration getDeletedResources()(Code) | | get the deleted but still stored resource
|
getFiles | public synchronized Enumeration getFiles()(Code) | | Get all the files handled by this generation
an enumeration of File |
getFillRatio | public float getFillRatio()(Code) | | Give the fill ratio for the cached resources
a float between 0 and 1 |
getGenerationFile | public File getGenerationFile()(Code) | | get the generation file
a File |
getId | public int getId()(Code) | | Get the ID of this generation
an int, the generation number |
getNext | public LRUAble getNext()(Code) | | LRU management - Get next node.
A CacheGeneration instance. |
getPrev | public LRUAble getPrev()(Code) | | LRU management - Get previous node.
A CacheGeneration instance. |
getStoredByteCount | public long getStoredByteCount()(Code) | | Give the acual storeage occupation level of this generation
a long, the number of bytes of this generation |
isLoaded | public boolean isLoaded()(Code) | | Is the generation loaded?
a boolean |
isSaved | public boolean isSaved()(Code) | | Is the generation saved?
a boolean |
loadCachedResource | protected void loadCachedResource(CachedResource cr)(Code) | | Load a CachedResource in this generation. (to be used only at
generation loading). This method load only valid cachedresource.
Check if the associated file exists and has the right size.
Parameters: CachedResource - the CachedResource to load. |
lookupResource | public synchronized CachedResource lookupResource(String url)(Code) | | Get the CachedResource relative to the given URL.
Parameters: url - the URL of the CachedResource to find a CachedResource or null. |
removeResource | public synchronized long removeResource(String url) throws NoSuchResourceException(Code) | | Remove the resource from the generation (but don't delete it).
Parameters: cr - the CachedResource to remove. the number of byte saved exception: NoSuchResourceException - if this resource was not in this generation |
setByteLimit | public synchronized void setByteLimit(long newlimit)(Code) | | Set the new bytecount limit, not that it may perform a cleanup
if necessary.
long, the new maximum number of bytes |
setDescription | protected void setDescription(LookupTable tables)(Code) | | Set this Generation as a description (update the saved and loaded
status)
Parameters: tables - the LookupTables containing attribute descriptions |
setGenerationFile | public void setGenerationFile(File generationFile)(Code) | | set the file where the generation is stored
Parameters: generationFile - the file |
setId | public synchronized void setId(int id)(Code) | | Set the ID of this generation
Useful to reuse generation
Parameters: an - integer, the new generation number |
setLoaded | protected void setLoaded(boolean loaded)(Code) | | Set the generation as loaded or unloaded
Parameters: loaded - the new loaded flag |
setNext | public synchronized void setNext(LRUAble next)(Code) | | LRU management - Set next node.
|
setPrev | public synchronized void setPrev(LRUAble prev)(Code) | | LRU management - Set previous node.
|
setSaved | protected void setSaved(boolean saved)(Code) | | Set the generation as saved or not.
Parameters: saved - a boolean |
unload | public void unload()(Code) | | Unload the generation, transform CachedResources to descriptions.
|
|
|