Main Page | Class Hierarchy | Class List | File List | Class Members

Common::CacheManager Class Reference

Inheritance diagram for Common::CacheManager:

Server::ServerCacheManager List of all members.

Public Member Functions

 CacheManager (long cacheSize)
bool CanService (HTTPRequest request)
HTTPResponse Get (HTTPRequest request)
void UpdateURIMapping (Uri URI, byte[] chk, string headers)
bool CacheContains (byte[] chk)
void UpdateCache (HTTPResponse response, Uri requestURI)
HTTPBody GetByChk (byte[] chk)

Static Public Member Functions

byte[] Patch (byte[] originalDocument, ArrayList changeHunks)
ArrayList Diff (System.IO.Stream oldDocStream, System.IO.Stream newDocStream)

Public Attributes

URIMapper uriMapper

Protected Attributes

Cache cache
long cacheSize
Object SyncRoot

Detailed Description

<summary> Manages a cache </summary>

Definition at line 11 of file CacheManager.cs.

Constructor & Destructor Documentation

Common::CacheManager::CacheManager long  cacheSize  )  [inline]

<summary> Creates a new cache manager with the specified cache size </summary> <param name="cacheSize">Size of cache in bytes</param>

Definition at line 22 of file CacheManager.cs.

Member Function Documentation

bool Common::CacheManager::CacheContains byte[]  chk  )  [inline]

<summary> Determines if a document is in the cache. </summary> <param name="chk">The CHK of the document to search for</param> <returns>True if the cache contains the document, false otherwise.</returns>

Definition at line 91 of file CacheManager.cs.

bool Common::CacheManager::CanService HTTPRequest  request  )  [inline]

<summary> Determines if the cache can service a HTTP Request. A cache can service a request if it has the request's URI in its mappings. If the mapping is stale, then it is automatically freshened. </summary> <param name="request">The HTTP Request to service</param> <returns>True if the cache will service the request, false otherwise</returns>

Definition at line 38 of file CacheManager.cs.

Referenced by Server::MCP::ServiceHTTPRequest().

HTTPResponse Common::CacheManager::Get HTTPRequest  request  )  [inline]

<summary> Constructs a HTTP Response from the cached data in the cache and the URI mapper. Assumes that the Requuest URI exists and is valid in the URI mapper. </summary> <param name="request">The Request to respond to.</param> <returns>A valid HTTP Response for the request</returns>

Definition at line 48 of file CacheManager.cs.

HTTPBody Common::CacheManager::GetByChk byte[]  chk  )  [inline]

<summary> Returns a cache entry by CHK. Consider using one of the other Gets instead, this one's only for delta-encoding. </summary> <param name="chk">The CHK of the entry to fetch</param> <returns>The HTTPBody of the entity</returns>

Definition at line 118 of file CacheManager.cs.

Referenced by Common::EncodedHTTPResponse::Decode(), and Common::EncodedHTTPResponse::EncodedHTTPResponse().

void Common::CacheManager::UpdateCache HTTPResponse  response,
Uri  requestURI

<summary> Adds response body to cache if not already there, freshens or creates URI mappings. </summary> <param name="response">The HTTP Response to process</param> <param name="request">The URI of the request</param>

Definition at line 100 of file CacheManager.cs.

Referenced by Server::MCP::ServiceHTTPRequest().

void Common::CacheManager::UpdateURIMapping Uri  URI,
byte[]  chk,
string  headers

<summary> Adds a URI to CHK mapping with associated headers, or freshens timestamp if such a mapping already exists. </summary> <param name="URI">The URI in the mapper to update.</param> <param name="chk">The CHK of the document body.</param> <param name="headers">The response headers to associate with the URI</param>

Definition at line 78 of file CacheManager.cs.

The documentation for this class was generated from the following file:
Generated on Mon May 8 22:07:27 2006 by  doxygen