Setting Up a Development Environment for the Application
To start with NCache, you need to install NuGet packages for .NET/.NET Core, add Maven dependencies for Java, Maven dependencies for Scala, install the required NPM packages for Node.js, install the necessary packages for Python, and add them respectively. Once complete, you need to specify namespaces, import packages, or get the specific modules in your application accordingly.
Install NuGet Packages for .NET Framework and .NET
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 in use.
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 given namespace to get started: Alachisoft.NCache.Client
Note
The NuGet packages provided by NCache include client.ncconf and config.ncconf. These files help 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.
- For NCache Enterprise Edition:
<dependency>
<groupId>com.alachisoft.ncache</groupId>
<artifactId>ncache-client</artifactId>
<version>x.x.x</version>
</dependency>
- For NCache Professional Edition:
<dependency>
<groupId>com.alachisoft.ncache</groupId>
<artifactId>ncache-professional-client</artifactId>
<version>x.x.x</version>
</dependency>
Specifying Packages for Java
You also need to import the given 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.
Adding Maven Dependencies for Scala
You need to add the following Maven <dependency
> section in your pom.xml file, which will add all the jars to your application.
- For NCache Enterprise Edition::
<dependency>
<groupId>com.alachisoft.ncache</groupId>
<artifactId>ncache-scala-client</artifactId>
<version>x.x.x</version>
</dependency>
- For NCache Professional Edition:
<dependency>
<groupId>com.alachisoft.ncache</groupId>
<artifactId>ncache-scala-professional-client</artifactId>
<version>x.x.x</version>
</dependency>
Specifying Packages for Scala
You also need to import the given package in your application to get started: import com.alachisoft.ncache.scala.client.*;
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, run the following commands in a shell environment. This will install all NCache client libraries in your application:
- For NCache Enterprise Edition::
npm install ncache-client
- For NCache Professional Edition:
npm install ncache-professional-client
Specify Modules
You also need to include the given module(s) in your application to get started:
- For NCache Enterprise Edition::
const ncache = require('ncache-client');
- For NCache Professional Edition:
const ncache = require('ncache-professional-client');
Install Python Client Using Pip
NCache provides python packages that contain various libraries for NCache to work in your client and server environments. To install the python packages for NCache Enterprise or Professional, run the following command in a shell environment. This will install all NCache client libraries in your application:
- For NCache Enterprise Edition:
pip install ncache-client
- For NCache Professional Edition:
pip install ncache-professional-client
Import Modules
In your client applicaiton, you will also have to import the NCache
module in order to start working with NCache using Python.
import NCache
See Also
Create Cache
Connecting to Cache
Add Data to Cache
Client Side API Programming