jason.service.http1_0.cache
Class Cache

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--jason.service.http1_0.cache.Cache
All Implemented Interfaces:
java.lang.Runnable

public class Cache
extends java.lang.Thread

Cache for HTTP Request

Since:
1.0
See Also:
Thread

Field Summary
static int FIFO
           
static int FREQUENCY
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Cache(int capacity, int refresh, int type)
           
 
Method Summary
 void addDoc(byte[] doc, java.lang.String path)
          Add an item in the cache
 void addDoc(jason.service.http1_0.cache.CacheItem item)
           
 byte[] getDoc(java.lang.String path)
           
static java.lang.StringBuffer loadDoc(java.io.File doc)
          Load a page
 void run()
           
 void setCapacity(int capacity)
           
 void setRefresh(int refresh)
           
 void setType(int type)
           
 void stat()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FREQUENCY

public static final int FREQUENCY
See Also:
Constant Field Values

FIFO

public static final int FIFO
See Also:
Constant Field Values
Constructor Detail

Cache

public Cache(int capacity,
             int refresh,
             int type)
Method Detail

setCapacity

public void setCapacity(int capacity)

setType

public void setType(int type)
Parameters:
type - cache type (FIFO or FREQUENCY)

setRefresh

public void setRefresh(int refresh)

addDoc

public void addDoc(byte[] doc,
                   java.lang.String path)
Add an item in the cache


addDoc

public void addDoc(jason.service.http1_0.cache.CacheItem item)

getDoc

public byte[] getDoc(java.lang.String path)
Returns:
the document for a relative path

stat

public void stat()

loadDoc

public static java.lang.StringBuffer loadDoc(java.io.File doc)
                                      throws java.io.IOException
Load a page

java.io.IOException

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread