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

NetworkCache Class Reference

Inheritance diagram for NetworkCache:

CacheInvalidator NetworkCombo List of all members.

Public Member Functions

 this (ICluster cluster, char[] channel)
IPayload get (char[] key)
IPayload extract (char[] key)
IPayload put (char[] key, IPayload payload)
ICache bind (ICacheLoader loader)
ICache bind (IRemoteCacheLoader loader)

Private Member Functions

void invalidate (char[] key, ulong timeLimit=ulong.max)

Static Private Member Functions

 this ()

Detailed Description

A gateway to the network cache. From here you can easily place IPayload objects into the network cluster, copy them and remove them. A cluster cache is spread out across many servers within the network. Each cache entry is associated with a 'channel', which is effectively the name of a cache instance within the cluster. See ComboCache also. The basic procedure is so:

import mango.cluster.NetworkCache; import mango.cluster.qos.socket.Cluster; ICluster cluster = new Cluster (...); NetworkCache cache = new NetworkCache (cluster, ...); cache.put (...); cache.get (...); cache.invalidate (...);

Note that any content placed into the cache must implement the IPayload interface, and must be enrolled with PickleRegistry, as it will be frozen and thawed as it travels around the network.

Definition at line 72 of file NetworkCache.d.


Member Function Documentation

this ICluster  cluster,
char[]  channel
[inline]
 

Construct a NetworkCache using the QOS (cluster) provided, and hook it onto the specified channel. Each subsequent operation is tied to this channel.

Reimplemented from CacheInvalidator.

Definition at line 82 of file NetworkCache.d.

IPayload get char[]  key  )  [inline]
 

Returns a copy of the cluster cache entry corresponding to the provided key. Returns null if there is no such entry.

Reimplemented in NetworkCombo.

Definition at line 94 of file NetworkCache.d.

Referenced by testClusterCache().

IPayload extract char[]  key  )  [inline]
 

Remove and return the cache entry corresponding to the provided key.

Reimplemented in NetworkCombo.

Definition at line 108 of file NetworkCache.d.

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

Add a cluster cache entry. The entry will be placed in one or more of the cluster servers (depending upon QOS).

Definition at line 122 of file NetworkCache.d.

Referenced by testClusterCache().

ICache bind ICacheLoader  loader  )  [inline]
 

Bind a local loader to this network cache. The loader will check that a cache entry is valid, and load up a fresh instance where a stale one is found. Each stale entry with the equivalent timestamp is removed across the entire network,

Definition at line 140 of file NetworkCache.d.

Referenced by bind(), and testRemoteCacheLoader().

ICache bind IRemoteCacheLoader  loader  )  [inline]
 

Bind a remote cache loader. Remote loaders are great for gating/synchronizing access to a particular resource over the entire cluster. When a cache entry fails its validity test, the loader is executed remotely by the cache host; the cache entry itself is 'locked' for the duration, such that requests from any cluster node will stall until the new entry is loaded. This is a convenient way to restrict load on an expensive resource (such as a slow or very busy back-end server).

Definition at line 159 of file NetworkCache.d.

References bind().

this  )  [inline, static, inherited]
 

Definition at line 63 of file Client.d.

References Client::EmptyMessage.

void invalidate char[]  key,
ulong  timeLimit = ulong.max
[inline, inherited]
 

Invalidate all network cache instances on this channel using the specified key. When 'timeLimit' is specified, only those cache entries with a time lesser or equal to that specified will be removed. This is often useful if you wish to avoid invalidating a cache (local or remote) that has just been updated; simply pass the time value of the 'old' IPayload as the argument.

Note that this is asynchronous! An invalidation is just a request to remove the item within a short time period. If you need the entry removed synchronously, you should use the NetworkCache extract() method instead.

Definition at line 90 of file CacheInvalidator.d.

Referenced by NetworkCombo::put(), and testInvalidatee().


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