DataCacheFactory Constructor (DataCacheServerEndpoint , Boolean, Boolean, DataCacheLocalCacheSyncPolicy, Int32, Int32)
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Used for configuring a cache client programmatically, based on the parameter values provided. Additional parameters provided for working with cache notifications.
Namespace: Microsoft.Data.Caching
Assembly: ClientLibrary (in clientlibrary.dll)
Syntax
'Declaration
Public Sub New ( _
servers As DataCacheServerEndpoint(), _
routingClient As Boolean, _
localCache As Boolean, _
syncPolicy As DataCacheLocalCacheSyncPolicy, _
localCacheTimeout As Integer, _
pollInterval As Integer _
)
'Usage
Dim servers As DataCacheServerEndpoint()
Dim routingClient As Boolean
Dim localCache As Boolean
Dim syncPolicy As DataCacheLocalCacheSyncPolicy
Dim localCacheTimeout As Integer
Dim pollInterval As Integer
Dim instance As New DataCacheFactory(servers, routingClient, localCache, syncPolicy, localCacheTimeout, pollInterval)
public DataCacheFactory (
DataCacheServerEndpoint[] servers,
bool routingClient,
bool localCache,
DataCacheLocalCacheSyncPolicy syncPolicy,
int localCacheTimeout,
int pollInterval
)
public:
DataCacheFactory (
array<DataCacheServerEndpoint^>^ servers,
bool routingClient,
bool localCache,
DataCacheLocalCacheSyncPolicy syncPolicy,
int localCacheTimeout,
int pollInterval
)
public DataCacheFactory (
DataCacheServerEndpoint[] servers,
boolean routingClient,
boolean localCache,
DataCacheLocalCacheSyncPolicy syncPolicy,
int localCacheTimeout,
int pollInterval
)
public function DataCacheFactory (
servers : DataCacheServerEndpoint[],
routingClient : boolean,
localCache : boolean,
syncPolicy : DataCacheLocalCacheSyncPolicy,
localCacheTimeout : int,
pollInterval : int
)
Parameters
- servers
The cache host configuration for the cache client, for an array of DataCacheServerEndpoint objects.
- routingClient
True when the GetCache method returns routing clients; otherwise, it returns simple clients.
- localCache
True when local cache is enabled on the cache client; otherwise, local cache is disabled.
- syncPolicy
Specifies the way locally cached objects should be invalidated, as defined by the LocalCacheSyncPolicy enumeration.
- localCacheTimeout
The number of seconds that objects will remain in local cache before they are invalidated. Not applicable to notification-based invalidation. For more information, see Expiration and Eviction (Velocity).
- pollInterval
The interval, in seconds, in which the cache client checks with the cache cluster for new notifications. Default value is 300 seconds. For more information, see Cache Notifications (Velocity).
Remarks
Before working with the cache, you must instantiate the DataCacheFactory class. When configuration parameters are passed to the DataCacheFactory class constructor, those configuration settings are used for all cache clients obtained from that DataCacheFactory object. Configuration parameters passed to the constructor override settings specified in the application configuration file. For more information about configuration options and settings for the cache client, see Configuration (Velocity).
For the servers parameter, make sure to specify those cache hosts that have been designated as lead hosts. Lead hosts are usually the first cache servers installed in the cluster. For more information about lead hosts, see Lead Hosts and Cluster Management (Velocity). You can determine which hosts are lead hosts by using the PowerShell administration tool. For more information about PowerShell, see Cache Administration with PowerShell (Velocity).
For more information about simple clients, routing clients, and local cache, see Cache Clients and Local Cache (Velocity).
Local cache is not required when working with cache notifications. This constructor can be used to set a specific poll interval for cache notifications when the default value of 300 seconds is not desired. For more information, see Cache Notifications (Velocity).
Note
In order for your application to use notifications, you will need to enable them on a named cache. Use the notificationsEnabled
parameter with the New-Cache
or Set-CacheConfig
commands. For more information, see Cache Administration with PowerShell (Velocity).
See Also
Reference
DataCacheFactory Class
DataCacheFactory Members
Microsoft.Data.Caching Namespace