Main Page | Class Hierarchy | Alphabetical List | Class List | 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 52 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 65 of file PlainCache.d.

References HashMap.

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 76 of file PlainCache.d.

References HashMap::get().

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 92 of file PlainCache.d.

References 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 105 of file PlainCache.d.

References 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 117 of file PlainCache.d.

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

ICache bind ICacheLoader  loader  )  [inline]
 

This is a factory for producing an ICache instance upon the cache content. The provided loader will populate the cache whenever a stale or missing entry is seen

Reimplemented from IMutableCache.

Definition at line 137 of file PlainCache.d.

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


Member Data Documentation

HashMap map [private]
 

Definition at line 54 of file PlainCache.d.


The documentation for this class was generated from the following file:
Generated on Sun Nov 7 19:07:09 2004 for Mango by doxygen 1.3.6