|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.www.protocol.http.cache.CacheGeneration
public class CacheGeneration
Field Summary | |
---|---|
protected java.io.File |
generationFile
|
protected LRUAble |
next
LRU management - next entry. |
protected LRUAble |
prev
LRU management - previous entry. |
Constructor Summary | |
---|---|
CacheGeneration(CacheStore store,
long maxsize)
|
Method Summary | |
---|---|
boolean |
addResource(CachedResource cr,
long size,
long oldsize)
Adds this resource, if possible |
void |
clean()
Clean this generation. |
long |
collectSpace(long size,
boolean check)
will garbage collect up to "size" bytes in this generation. |
boolean |
containsResource(java.lang.String url)
Check if a resource has been cached in this generation |
protected void |
copyInto(CacheGeneration gen)
copy the content of the generation here |
protected void |
deleteGenerationFile()
delete the serialized resource file from the disk |
long |
deleteStored(CachedResource cr)
Deletes a resource from the "to be deleted" vector it updates also the number of bye stored in this generation |
protected long |
emptyGeneration()
empty this generation |
long |
getByteLimit()
Get the bytecount limit for this generation |
long |
getCachedByteCount()
Give the acual occupation level of this generation |
java.util.Enumeration |
getCachedResources()
Get the CachedResource of this generation (except the "to be deleted" resources) |
int |
getCRCount()
Get the current number of resource loaded. |
java.util.Enumeration |
getDeletedResources()
get the deleted but still stored resource |
java.util.Enumeration |
getFiles()
Get all the files handled by this generation |
float |
getFillRatio()
Give the fill ratio for the cached resources |
java.io.File |
getGenerationFile()
get the generation file |
int |
getId()
Get the ID of this generation |
LRUAble |
getNext()
LRU management - Get next node. |
LRUAble |
getPrev()
LRU management - Get previous node. |
long |
getStoredByteCount()
Give the acual storeage occupation level of this generation |
boolean |
isLoaded()
Is the generation loaded? |
boolean |
isSaved()
Is the generation saved? |
protected void |
loadCachedResource(CachedResource cr)
Load a CachedResource in this generation. |
CachedResource |
lookupResource(java.lang.String url)
Get the CachedResource relative to the given URL. |
long |
removeResource(CachedResource cr)
Remove the resource from the generation (but don't delete it). |
long |
removeResource(java.lang.String url)
Remove the resource from the generation (but don't delete it). |
void |
setByteLimit(long newlimit)
Set the new bytecount limit, not that it may perform a cleanup if necessary. |
protected void |
setDescription(LookupTable[] tables)
Set this Generation as a description (update the saved and loaded status) |
void |
setGenerationFile(java.io.File generationFile)
set the file where the generation is stored |
void |
setId(int id)
Set the ID of this generation Useful to reuse generation |
protected void |
setLoaded(boolean loaded)
Set the generation as loaded or unloaded |
void |
setNext(LRUAble next)
LRU management - Set next node. |
void |
setPrev(LRUAble prev)
LRU management - Set previous node. |
protected void |
setSaved(boolean saved)
Set the generation as saved or not. |
void |
unload()
Unload the generation, transform CachedResources to descriptions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.File generationFile
protected LRUAble prev
protected LRUAble next
Constructor Detail |
---|
public CacheGeneration(CacheStore store, long maxsize)
Method Detail |
---|
public void setGenerationFile(java.io.File generationFile)
generationFile
- the filepublic java.io.File getGenerationFile()
public boolean isLoaded()
protected void setLoaded(boolean loaded)
loaded
- the new loaded flagpublic boolean isSaved()
protected void setSaved(boolean saved)
saved
- a booleanpublic LRUAble getNext()
getNext
in interface LRUAble
public LRUAble getPrev()
getPrev
in interface LRUAble
public void setNext(LRUAble next)
setNext
in interface LRUAble
public void setPrev(LRUAble prev)
setPrev
in interface LRUAble
public int getId()
public void setId(int id)
an
- integer, the new generation numberpublic long getCachedByteCount()
public float getFillRatio()
public long getStoredByteCount()
public long getByteLimit()
public void setByteLimit(long newlimit)
long,
- the new maximum number of bytespublic long deleteStored(CachedResource cr)
public boolean containsResource(java.lang.String url)
url
- the resource url
public java.util.Enumeration getFiles()
public CachedResource lookupResource(java.lang.String url)
url
- the URL of the CachedResource to find
public boolean addResource(CachedResource cr, long size, long oldsize)
cr,
- the candidate.size,
- the size of the candidate.
protected void loadCachedResource(CachedResource cr)
CachedResource
- the CachedResource to load.public long removeResource(CachedResource cr) throws NoSuchResourceException
cr
- the CachedResource to remove.
NoSuchResourceException
- if this resource was not in this
generationpublic long removeResource(java.lang.String url) throws NoSuchResourceException
cr
- the CachedResource to remove.
NoSuchResourceException
- if this resource was not in this
generationpublic long collectSpace(long size, boolean check)
long
- the number of bytes to be collectedcheck,
- a boolean, used to validate or not the resource before
deleting them (ie: delete only invalid resources)
protected long emptyGeneration()
public java.util.Enumeration getCachedResources()
public java.util.Enumeration getDeletedResources()
protected void setDescription(LookupTable[] tables)
tables
- the LookupTables containing attribute descriptionspublic void unload()
protected void deleteGenerationFile()
public int getCRCount()
public void clean()
protected void copyInto(CacheGeneration gen)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |