Class CacheSyncDependency
A client application can have more than one cache instances initialized. CacheSyncDependency keeps the items present in one cache synchronized with the items present in another cache.
Inheritance
Namespace:
Assembly: Alachisoft.NCache.Web.dll
Syntax
[Serializable]
public class CacheSyncDependency : ICompactSerializable
Remarks
You can add items with CacheSyncDependency to your application's cache with the Add(String, Object) and Insert(String, Object) methods.
When you add an item to an application's Cache object with
CacheSyncDependency, it monitors the remote cache (the cache you want your local cache
to be synchronized with) for changes. As soon as an item is updated in or removed from the remote cache
this change is automatically updated in the local cache if the CacheSyncDependency was provided with the
cache items.
This helps you keep your local cache synchronized with the remote cache all the time.
Constructors
CacheSyncDependency(String, String)
Initializes a new instance of the CacheSyncDependency with the specified parameters. Internally it tries to initialize the remote cache. If the cache can not be initialized, it throws the exception describing the cause of failure. The remote cache must be running as outproc even if it is on the same machine. The information to connect to the remote cache instance (like server-name and server-port) are picked from the 'client.ncconf'.
Declaration
public CacheSyncDependency(string remoteCacheId, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | remoteCacheId | The unique id of the remote cache |
System.String | key | The key of the item in the remote cache with which the local cache item will be kept synchronized. |
CacheSyncDependency(String, String, String, Byte[])
Initializes a new instance of the CacheSyncDependency with the specified parameters. Internally it tries to initialize the remote cache. If the cache can not be initialized, it throws the exception describing the cause of failure. The remote cache must be running as outproc even if it is on the same machine. The information to connect to the remote cache instance (like server-name and server-port) are picked from the 'client.ncconf'.
Declaration
public CacheSyncDependency(string remoteCacheId, string key, string userId, byte[] password)
Parameters
Type | Name | Description |
---|---|---|
System.String | remoteCacheId | The unique id of the remote cache |
System.String | key | The key of the item in the remote cache with which the local cache item will be kept synchronized. |
System.String | userId | The user id of the remote cache |
System.Byte[] | password | The Security password of the remote cache |
CacheSyncDependency(String, String, String, Int32)
Initializes a new instance of the CacheSyncDependency with the specified parameters. Internally it tries to initialize the remote cache. If the cache can not be initialized, it throws the exception describing the cause of failure. The remote cache must be running as outproc even if it is on the same machine.
Declaration
public CacheSyncDependency(string remoteCacheId, string key, string server, int port)
Parameters
Type | Name | Description |
---|---|---|
System.String | remoteCacheId | The unique id of the remote cache |
System.String | key | The key of the item in the remote cache with which the local cache item will be kept synchronized. |
System.String | server | The name of the server where the remote cache is running |
System.Int32 | port | The port used by the client to connect to the server |
CacheSyncDependency(String, String, String, Int32, String, Byte[])
Initializes a new instance of the CacheSyncDependency with the specified parameters. Internally it tries to initialize the remote cache. If the cache can not be initialized, it throws the exception describing the cause of failure. The remote cache must be running as outproc even if it is on the same machine.
Declaration
public CacheSyncDependency(string remoteCacheId, string key, string server, int port, string userID, byte[] password)
Parameters
Type | Name | Description |
---|---|---|
System.String | remoteCacheId | The unique id of the remote cache |
System.String | key | The key of the item in the remote cache with which the local cache item will be kept synchronized. |
System.String | server | The name of the server where the remote cache is running |
System.Int32 | port | |
System.String | userID | |
System.Byte[] | password | The Security password of the remote cache |
Properties
CacheId
The unique Id of the remote cache
Declaration
public string CacheId { get; }
Property Value
Type | Description |
---|---|
System.String |
Key
The key of the item in the remote cache with which the local cache item needs to be synchronized.
Declaration
public string Key { get; }
Property Value
Type | Description |
---|---|
System.String |
Password
Declaration
public byte[] Password { get; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Port
The server port that is used by the clients to connect to the server.
Declaration
public int Port { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Server
The name of the server where the remote cache is running.
Declaration
public string Server { get; }
Property Value
Type | Description |
---|---|
System.String |
UserId
Declaration
public string UserId { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Deserialize(CompactReader)
Declaration
public void Deserialize(CompactReader reader)
Parameters
Type | Name | Description |
---|---|---|
CompactReader | reader |
Implements
Serialize(CompactWriter)
Declaration
public void Serialize(CompactWriter writer)
Parameters
Type | Name | Description |
---|---|---|
CompactWriter | writer |