org.w3c.www.protocol.http.cache
Class CacheState

java.lang.Object
  |
  +--org.w3c.www.protocol.http.cache.CacheState

public class CacheState
extends java.lang.Object


Field Summary
protected  int basegen
           
protected  int byteused
           
protected  int curgen
           
protected  int dirid
           
protected  CacheFilter filter
           
protected  int generation
           
protected static int GENERATIONS_HISTORY_SIZE
           
protected  int[] gensizes
           
protected  org.w3c.www.protocol.http.cache.Subdirectory[] subdirs
           
 
Constructor Summary
CacheState(CacheFilter filter, jdbmResourceStore store)
          Rebuild the cache state out of the given store of cached entries.
 
Method Summary
protected  int computeCollectGeneration(int size)
          Compute generation number to sweep, given amount of data to collect.
 int getBaseGeneration()
           
 int getCacheUsed()
           
protected  int getCurrentGenerationSize()
          Get current generation size.
 int getGeneration()
           
 int[] getGenerationsSize()
           
protected  java.io.File getNextFile()
           
 void print(java.io.PrintStream out)
           
 void setBaseGeneration(int newbase)
           
 void setGeneration(int g)
           
 void setGenerationsSize(int[] sizes)
           
 int setNextGeneration()
          Get the next collector generation number, and update state.
 int updateCacheSpaceCounter(int size)
          Update cache space counter.
protected  void updateGenerationSize(int generation, int size)
          Update generations size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENERATIONS_HISTORY_SIZE

protected static final int GENERATIONS_HISTORY_SIZE

dirid

protected int dirid

byteused

protected int byteused

generation

protected int generation

gensizes

protected int[] gensizes

basegen

protected int basegen

curgen

protected int curgen

filter

protected CacheFilter filter

subdirs

protected org.w3c.www.protocol.http.cache.Subdirectory[] subdirs
Constructor Detail

CacheState

public CacheState(CacheFilter filter,
                  jdbmResourceStore store)
Rebuild the cache state out of the given store of cached entries.
Parameters:
store - The resource store for cached entries.
Method Detail

getCacheUsed

public final int getCacheUsed()

getGeneration

public final int getGeneration()

setGeneration

public final void setGeneration(int g)

getBaseGeneration

public final int getBaseGeneration()

setBaseGeneration

public final void setBaseGeneration(int newbase)

getGenerationsSize

public final int[] getGenerationsSize()

setGenerationsSize

public final void setGenerationsSize(int[] sizes)

getNextFile

protected java.io.File getNextFile()

setNextGeneration

public int setNextGeneration()
Get the next collector generation number, and update state.
Returns:
The next (which will be current when the method returns) collector generation.

updateGenerationSize

protected void updateGenerationSize(int generation,
                                    int size)
Update generations size
Parameters:
generation - The generation whose size is changing.
size - The delta with previous size.

getCurrentGenerationSize

protected int getCurrentGenerationSize()
Get current generation size.
Returns:
The size in bytes of the current generation.

computeCollectGeneration

protected int computeCollectGeneration(int size)
Compute generation number to sweep, given amount of data to collect.
Parameters:
size - The size of data to be collected.

updateCacheSpaceCounter

public int updateCacheSpaceCounter(int size)
Update cache space counter.
Parameters:
size - The number of bytes used (if positif), or the number of bytes freed (if negative).
Returns:
The total number of bytes used.

print

public void print(java.io.PrintStream out)