Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)
Syntax
C# |
---|
[ObsoleteAttribute("This method is deprecated. 'Please use InitializeCache(string cacheId, CacheInitParams initParams)'", false)] public static Cache InitializeCache( string cacheId, string server, int port ) |
Visual Basic |
---|
<ObsoleteAttribute("This method is deprecated. 'Please use InitializeCache(string cacheId, CacheInitParams initParams)'", _ False)> _ Public Shared Function InitializeCache ( _ cacheId As String, _ server As String, _ port As Integer _ ) As Cache |
Visual C++ |
---|
public: [ObsoleteAttribute(L"This method is deprecated. 'Please use InitializeCache(string cacheId, CacheInitParams initParams)'", false)] static Cache^ InitializeCache( String^ cacheId, String^ server, int port ) |
Parameters
- cacheId
- Type: System..::..String
The identifier for the Cache item to initialize.
- server
- Type: System..::..String
The identifier for the server where the cache is running.
- port
- Type: System..::..Int32
The port at which the server accepts the remote client connections.
Remarks
As this overload does not take SecurityParams, internally it tries to load this information from "client.ncconf" file. For more details see NCache Help Collection.
Calling this method twice with the same cacheId increments the reference count of the cache. The number of InitializeCache(String) calls must be balanced by a corresponding same number of Dispose()()()() calls.
Multiple cache instances can be inititalized within the same application domain. If multiple cache instances are initialized, Cache refers to the first instance of the cache.
Note: When starting a Cache as outproc, this method attempts to start NCache service on the local machine if it is not already running. However it does not start the cache automatically.
Examples
public override void Init() { // A cache with id 'myCache' is already registered. try { Alachisoft.NCache.Web.Caching.Cache theCache = NCache.InitializeCache("myCache", "server-name","9900")); } catch(Exception e) { // Cache is not available. } }
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | cacheId is a null reference (Nothing in Visual Basic). |