Setting Up Development Environment for Application
In order to begin development of applications using NCache features, you need to have NCache installed.
To start with NCache, you can need to install NuGet packages for .NET/.NET Core, add Maven dependencies for Java, and install the required NPM packages for Node.js respectively. Once this is done, you need to specify namespaces, import packages or require the specific modules in your application accordingly.
Install NuGet Packages for ASP.NET and ASP.NET Core
NCache provides NuGet packages for all editions which contain client libraries. To get started, you need to install the NCache SDK NuGet package.
Open Visual Studio and go to Tools -> NuGet Package Manager -> Package Manager Console.
On the console, execute the required command to install the NCache SDK NuGet package according to the edition you are using.
Note
Replace "x.x.x" with the version of NCache you are using.
Install-Package Alachisoft.NCache.SDK –Version x.x.x
Install-Package Alachisoft.NCache.Professional.SDK –Version x.x.x
Install-Package Alachisoft.NCache.OpenSource.SDK –Version x.x.x
Specify Namespaces
You can now begin creating applications utilizing NCache's features, however, you need to specify the following namespace to get started:
Alachisoft.NCache.Client;
Note
The NuGet packages provided by NCache include client.ncconf and cache.ncconf. These files are used to configure your NCache. See Client Config and Cache Config for details.
Adding Maven Dependencies for Java
You need to add the following Maven <dependency
> section in your pom.xml file, which will add all the jars to your application.
<dependency>
<groupId>com.alachisoft.ncache</groupId>
<artifactId>ncache-client</artifactId>
<version>5.2.0</version>
</dependency>
Specifying Packages
You also need to import the following package in your application to get started:
import com.alachisoft.ncache.client.*;
Note
The Maven packages provided by NCache does not include client.ncconf and config.ncconf files. To configure your caches, you have to manually create these files as per your need. You can find the snippet of these files as well as their details in our Administrator's Guide: Client Config and Cache Config.
Install NPM Packages for Node.js
NCache provides npm packages that contain various libraries for NCache to work in your client and server environments. To install npm packages for NCache Enterprise, run the following command in a shell environment. This will install all NCache client libraries in your application:
npm install ncache-client
Specify Modules
You also need to include the following module(s) in your application to get started:
const ncache = require('ncache-client');
See Also
Create Cache
Connecting to Cache
Add Data to Cache
Client Side API Programming