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

IRemoteCacheLoader Struct Reference

Inheritance diagram for IRemoteCacheLoader:

IPayload ICacheLoader IPickle IPickleFactory IWritable IReadable List of all members.

Public Member Functions

uint pause (uint wait)
long getTime ()
void setTime (long time)
void destroy ()
char[] getGuid ()
void write (IWriter w)

Private Member Functions

bool test (IPayload p)
IPayload load (char[] key, long time)

Detailed Description

Manages the loading of ICache entries remotely, on the device that actually contains the remote cache entry. The benefit of this approach lies in the ability to 'gate' access to specific resources across the entire network. That is; where particular entries are prohibitively costly to construct, it's worthwhile ensuring that cost is reduced to a bare minimum. These remote loaders allow the cache host to block multiple network clients until there's a new entry available. Without this mechanism, it's possible for multiple network clients to request the same entry simultaneously; therefore increasing the overall cost. The end result is similar to that of a distributed-transaction.

Definition at line 158 of file ICache.d.


Member Function Documentation

uint pause uint  wait  ) 
 

Return the sleep duration between attempts to retrieve a locked cache entry. Consider setting this duration to be approximately half the time you'd expect each remote cache-load to typically consume. The 'wait' argument is a representation of how many microseconds have added up while waiting. When this value exceeds some limit, you should return zero to indicate a timeout condition.

Note that the return value should be in microseconds ~ one tenth of a second equals 100_000 microseconds. Note also that you might consider returning a sliding value, where the pause starts off small, and increases as time passes. A simple implementation might look like this:

return (wait > 2_000_000) ? 0 : 10_000 + wait / 2;

Referenced by testRemoteCacheLoader().

long getTime  )  [inherited]
 

Reimplemented in Payload.

Referenced by PlainCache::bind(), PlainCache::extract(), CacheServer::LoaderThread::load(), and NetworkCombo::put().

void setTime long  time  )  [inherited]
 

Reimplemented in Payload.

void destroy  )  [inherited]
 

Perform whatever cleanup is necessary. Could use ~this() instead, but I prefer it to be truly explicit.

Reimplemented in Payload, QueuedEntry, InvalidatorPayload, and ClusterEntry.

Referenced by CacheInvalidatee::notify().

char [] getGuid  )  [inherited]
 

Identify this serializable class via a char[]. This should be (per class) unique within the domain. Use version numbers or similar mechanism to isolate different implementations of the same class.

Reimplemented in Payload, InvalidatorPayload, Message, NullMessage, Task, and RollCall.

Referenced by ClusterServer::addCacheLoader(), PickleWriter::freeze(), testClassSerialization(), and testRemoteCacheLoader().

void write IWriter  w  )  [inherited]
 

Reimplemented in Payload, InvalidatorPayload, Message, Task, Channel, RollCall, ResponseLine, Cookie, HttpCookies, HttpMessage, HttpRequest, HttpResponse, HttpTokens, NewlineWriter, FilePath, Token, and Uri.

Referenced by PickleWriter::freeze(), HttpClient::open(), AbstractWriter::put(), testClassIO(), testClassSerialization(), testCompositeIO(), testRemoteCacheLoader(), and HttpRequest::write().

bool test IPayload  p  )  [inherited]
 

Test the cache entry to see if it is still valid. A true return value indicates the entry is valid, whereas false flags the entry as stale. The latter case will cause the load() method to be invoked.

Reimplemented in NetworkCache::RemoteLoader.

Referenced by PlainCache::bind(), testCacheLoader(), and testRemoteCacheLoader().

IPayload load char[]  key,
long  time
[inherited]
 

Load a cache entry from wherever the content is persisted. The 'time' argument represents that belonging to a stale entry, which can be used to optimize the loader operation (no need to perform a full load where there's already a newer version in an L2 cache). This 'time' value will be long.min where was no such stale entry.

Reimplemented in NetworkCache::RemoteLoader.

Referenced by PlainCache::bind(), CacheServer::LoaderThread::load(), testCacheLoader(), and testRemoteCacheLoader().


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