Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

PlainCache Class Reference

Inheritance diagram for PlainCache:

IMutableCache QueuedCache VirtualCache List of all members.

Public Member Functions

 this (uint capacity=101, uint concurrency=16)
IPayload get (char[] key)
IPayload put (char[] key, IPayload entry)
IPayload extract (char[] key)
IPayload extract (char[] key, ulong timeLimit)
ICache bind (ICacheLoader loader)

Private Attributes

HashMap map

Detailed Description

A base-class for the cache framework, using a thread-aware hash map to contain the cache entries. Cache entries must be instances of the IPayload interface; this allows them to be moved around the network or serialized onto some external medium.

Definition at line 55 of file PlainCache.d.


Member Function Documentation

this uint  capacity = 101,
uint  concurrency = 16
[inline]
 

Construct a basic cache with the specified number of preallocated entries. The concurrency level indicates approximately how many threads will content for write access at one time.

Reimplemented in QueuedCache.

Definition at line 68 of file PlainCache.d.

References HashMap, and map.

IPayload get char[]  key  )  [inline]
 

Get the cache entry identified by the given key

Reimplemented from ICache.

Reimplemented in QueuedCache, and VirtualCache.

Definition at line 79 of file PlainCache.d.

References HashMap::get(), and map.

Referenced by bind(), and testPlainCache().

IPayload put char[]  key,
IPayload  entry
[inline]
 

Place an entry into the cache and associate it with the provided key. Note that there can be only one entry for any particular key. If two keys entries are added with the same key, the second effectively overwrites the first.

Returns what it was given

Reimplemented from IMutableCache.

Reimplemented in QueuedCache, and VirtualCache.

Definition at line 96 of file PlainCache.d.

References map, and HashMap::put().

Referenced by testPlainCache().

IPayload extract char[]  key  )  [inline]
 

Remove (and return) the cache entry associated with the provided key. Returns null if there is no such entry.

Definition at line 109 of file PlainCache.d.

References map, and HashMap::remove().

Referenced by testPlainCache().

IPayload extract char[]  key,
ulong  timeLimit
[inline]
 

Remove (and return) the cache entry associated with the provided key. Returns null if there is no such entry.

Reimplemented from IMutableCache.

Reimplemented in QueuedCache, and VirtualCache.

Definition at line 122 of file PlainCache.d.

References HashMap::get(), IPayload::getTime(), map, and HashMap::remove().

ICache bind ICacheLoader  loader  )  [inline]
 

Reimplemented from IMutableCache.

Definition at line 143 of file PlainCache.d.

References get(), IPayload::getTime(), ICacheLoader::load(), and ICacheLoader::test().


Member Data Documentation

HashMap map [private]
 

Definition at line 57 of file PlainCache.d.

Referenced by extract(), get(), put(), and this().


The documentation for this class was generated from the following file:
Generated on Fri May 27 18:12:03 2005 for Mango by  doxygen 1.4.0