NCache
Author: c | 2025-04-24
NCache. NCache Enterprise; NCache Professional; Edition Comparison; NCache Architecture; Benchmarks; Download Pricing NCache Playground Deployments. Cloud (SaaS Software)
Use NCache with NHibernate - NCache - alachisoft.com
Linux: docker pull alachisoft/ncache:latestdocker run -d --name ncache-server --network host alachisoft/ncache:latestdocker exec -it ncache-server ncache service start C. Configure NCache for MongoDBTo integrate MongoDB with NCache, follow these steps:Create and Configure Cache: New-Cache -Name MongoDBCache -Size 1024 -Topology PartitionReplica -Server 192.168.1.2Add-Node -CacheName MongoDBCache -Server 192.168.1.3 Modify .NET Application to Use NCache: ICache cache = CacheManager.GetCache("MongoDBCache");var collection = new MongoClient("mongodb://your-mongodb-url") .GetDatabase("ECommerceDB") .GetCollectionCustomer>("Customers");var customer = await collection.Find(x => x.Id == "EINSTEIN").FirstOrDefaultAsync();if (customer != null){ cache.Insert("Customer:EINSTEIN", new CacheItem(customer) { Expiration = new Expiration(ExpirationType.Absolute, TimeSpan.FromMinutes(10)) });} NCache DetailsCache DependenciesNCache DocsConclusionUsing NCache with MongoDB enhances application performance by reducing database load, improving response times, and ensuring real-time data consistency. By leveraging in-memory caching, applications benefit from faster data access, lower latency, and seamless scalability. NCache’s distributed architecture provides high availability and ensures fault tolerance, making it an ideal choice for modern, high-traffic .NET applications utilizing MongoDB.NCache DetailsDownload NCacheEdition Comparison Sajid Naeem is Product QA Architect for NCache. His current role sees him focusing on the design and implementation of QA frameworks. In addition to this role, he is focused on delivering product training across the company. In summary, Sajid is a well-balanced professional with a wealth of technical experience and extensive knowledge.. NCache. NCache Enterprise; NCache Professional; Edition Comparison; NCache Architecture; Benchmarks; Download Pricing NCache Playground Deployments. Cloud (SaaS Software) NCache Details; NCache Data Source Providers; NCache Docs; Using Read-Through with NCache. In Read-Through Caching, when there is a cache miss, NCache will NCache. NCache Enterprise; NCache Professional; Edition Comparison; NCache Architecture; Benchmarks; Download Pricing NCache Playground Deployments. Cloud (SaaS Software) On-Premises; Kubernetes / Docker Read online documentation for NCache Open Source, NCache Professional and NCache Enterprise. Download NCache. Contact Us PHONE 1 (214) (US) 44 20 7993 8327 (UK) EMAIL NCache. NCache Enterprise; NCache NCache. NCache Enterprise; NCache Professional; Edition Comparison; NCache Architecture; Benchmarks; Download Pricing Try Playground Deployments. Cloud (SaaS Software) On Now a day’s insurance leaders have to customer data coming in from multiple sources, and also keep this data safe and secure. NCache brings scale, performance and high reliability for Insurance industry applications and data storage. Our insurance industry customers use NCache for session clustering, distributed synchronization and main high speed data store. NCache adds horizontal scalability for reduced cost and better multi-region data center replication. The ability to easily plug-in new hardware for horizontal scalability is key here. NCache is perfect candidate for building high performing benefits management and administration solutions. By caching frequently used data, overall responsiveness of applications improves. Resulting in better agility and pace. Imagine NCache as single data store for managing information and maintain 360-degree view of customers. Smart runtime rule based applications can be built to help with these use cases: Featured Customers Following are some interesting use cases of NCache for Insurance industry needs: Usage based Insurance Insights Prevent Double Billing Legacy System Transformation Reduce benefits costs & Maximize benefits value Single data store for 360-degree Customer view Risk Management as a Service Intelligent Cross Selling Cybersecurity & Encryption to meet Privacy Compliance Distributed Ledgers & Smart Financial Technology What to Do Next? Case Studies Download NCache Edition ComparisonComments
Linux: docker pull alachisoft/ncache:latestdocker run -d --name ncache-server --network host alachisoft/ncache:latestdocker exec -it ncache-server ncache service start C. Configure NCache for MongoDBTo integrate MongoDB with NCache, follow these steps:Create and Configure Cache: New-Cache -Name MongoDBCache -Size 1024 -Topology PartitionReplica -Server 192.168.1.2Add-Node -CacheName MongoDBCache -Server 192.168.1.3 Modify .NET Application to Use NCache: ICache cache = CacheManager.GetCache("MongoDBCache");var collection = new MongoClient("mongodb://your-mongodb-url") .GetDatabase("ECommerceDB") .GetCollectionCustomer>("Customers");var customer = await collection.Find(x => x.Id == "EINSTEIN").FirstOrDefaultAsync();if (customer != null){ cache.Insert("Customer:EINSTEIN", new CacheItem(customer) { Expiration = new Expiration(ExpirationType.Absolute, TimeSpan.FromMinutes(10)) });} NCache DetailsCache DependenciesNCache DocsConclusionUsing NCache with MongoDB enhances application performance by reducing database load, improving response times, and ensuring real-time data consistency. By leveraging in-memory caching, applications benefit from faster data access, lower latency, and seamless scalability. NCache’s distributed architecture provides high availability and ensures fault tolerance, making it an ideal choice for modern, high-traffic .NET applications utilizing MongoDB.NCache DetailsDownload NCacheEdition Comparison Sajid Naeem is Product QA Architect for NCache. His current role sees him focusing on the design and implementation of QA frameworks. In addition to this role, he is focused on delivering product training across the company. In summary, Sajid is a well-balanced professional with a wealth of technical experience and extensive knowledge.
2025-04-16Now a day’s insurance leaders have to customer data coming in from multiple sources, and also keep this data safe and secure. NCache brings scale, performance and high reliability for Insurance industry applications and data storage. Our insurance industry customers use NCache for session clustering, distributed synchronization and main high speed data store. NCache adds horizontal scalability for reduced cost and better multi-region data center replication. The ability to easily plug-in new hardware for horizontal scalability is key here. NCache is perfect candidate for building high performing benefits management and administration solutions. By caching frequently used data, overall responsiveness of applications improves. Resulting in better agility and pace. Imagine NCache as single data store for managing information and maintain 360-degree view of customers. Smart runtime rule based applications can be built to help with these use cases: Featured Customers Following are some interesting use cases of NCache for Insurance industry needs: Usage based Insurance Insights Prevent Double Billing Legacy System Transformation Reduce benefits costs & Maximize benefits value Single data store for 360-degree Customer view Risk Management as a Service Intelligent Cross Selling Cybersecurity & Encryption to meet Privacy Compliance Distributed Ledgers & Smart Financial Technology What to Do Next? Case Studies Download NCache Edition Comparison
2025-04-17And Write-Through caching to reduce direct database queries.Integrates seamlessly with .NET 8 and cloud environments (Azure, AWS, Kubernetes).Implementing MongoDB Caching with NCacheYou can easily implement MongoDB caching with NCache as demonstrated below:Caching Query Results in MongoDB 12345678910111213141516171819 ICache cache = CacheManager.GetCache("MongoDBCache");string cacheKey = "Customer:EINSTEIN";Customer customer = cache.GetCustomer>(cacheKey);if (customer == null){ var collection = new MongoClient("mongodb://your-mongodb-url") .GetDatabase("ECommerceDB") .GetCollectionCustomer>("Customers"); customer = await collection.Find(x => x.Id == "EINSTEIN").FirstOrDefaultAsync(); if (customer != null) { cache.Insert(cacheKey, new CacheItem(customer) { Expiration = new Expiration(ExpirationType.Absolute, TimeSpan.FromMinutes(5)) }); }} Caching MongoDB CollectionsYou can easily cache MongoDB collections as below: Cache Collection as a Single ItemStoring an entire collection as a single cache item allows for quick retrieval in one operation, reducing cache lookups and improving batch processing or UI rendering performance. var customersInGermany = await collection.Find(x => x.Country == "Germany").ToListAsync();if (customersInGermany.Count > 0){ ICache cache = CacheManager.GetCache("MongoDBCache"); var cacheItem = new CacheItem(customersInGermany) { Expiration = new Expiration(ExpirationType.Absolute, TimeSpan.FromMinutes(10)) }; cache.Insert("Customers:Germany", cacheItem);} Cache Collection Items SeparatelyStoring each item separately ensures individual access while using tags to group related items, making bulk retrieval faster and improving query performance. foreach (var customer in customersInGermany){ var cacheItem = new CacheItem(customer) { Tags = new Tag[] { new Tag("Customer:Country:Germany") }, Expiration = new Expiration(ExpirationType.Absolute, TimeSpan.FromMinutes(10)) }; cache.Insert($"Customer:CustomerID:{customer.Id}", cacheItem);} Synchronizing Cache with MongoDB Using Change StreamsTo ensure data consistency between MongoDB and the cache, change streams allow for real-time synchronization by detecting inserts, updates, and deletes. Whenever data changes, NCache can remove or update the corresponding cache entry, preventing stale data issues. var pipeline = new EmptyPipelineDefinitionChangeStreamDocumentCustomer>>() .Match("{ operationType: { $in: ['insert', 'update', 'replace', 'delete'] } }");var cursor = collection.Watch(pipeline);await cursor.ForEachAsync(change =>{ string cacheKey = $"Customer:CustomerID:{change.FullDocument.Id}"; cache.Remove(cacheKey);}); Querying Cached Data in NCacheNCache allows users to query cached data using SQL queries, reducing database load while improving application performance. Indexed queries enable faster lookups and filtering on cached objects. // Connect to NCacheICache cache = CacheManager.GetCache("MongoDBCache");// Define NCache search querystring query = "SELECT * FROM Models.Customer WHERE Country = ?";var queryCommand = new QueryCommand(query);queryCommand.Parameters.Add("Country", "Germany");// Execute query on cacheICacheReader reader = cache.SearchService.ExecuteReader(queryCommand);while (reader.Read()){ string contactName = reader.GetValuestring>("ContactName"); Console.WriteLine($"Contact Name: {contactName}");} NCache DetailsCache DependenciesNCache DocsHow to Configure NCache for MongoDB?To configure NCache for MongoDB, follow the steps below:A. Install NCache ClientTo install the NCache client in a .NET application, use NuGet to add the required package: Install-Package Alachisoft.NCache.SDK Once installed, configure your application to use NCache for caching data.B. Install NCache ServerTo install NCache Server on
2025-04-17All the data in the cache at cache startup? With the Cache Loader interface provided by NCache, all data from the persistent store is duplicated to the cache on startup so it is available for the application to use. public class PersistenceStartupLoader : ProviderBase, ICacheLoader{ public LoaderResult LoadNext(object userContext) { if (persistentItems == null) persistentItems = _persistenceProvider.GetAll(); LoaderResult result = new LoaderResult(); foreach (var item in persistentItems) { result.Data.Add(new KeyValuePairstring, ProviderItemBase>(item.Key, item.Value)); } return result; }} NCache Details Cache Startup Loader DocsDelete Data from Persistent DatastoreIn the solution I made, the persistent store is linked to your cache so any changes made within the cache would also be made inside the persistent store. For instance, a data item is stored in cache as well as a persistent store. When the user deletes it from the cache, it will cause it to get deleted from the persistent store as well, with the help of the write-through provider. This will ensure the main cache remains in sync with the persistent data store.However, this is completely flexible, you can alter this and have items stored in the persistent store even if the application sends in a delete command.Why NCache?NCache is a fast and scalable market-leading in-memory distributed cache made 100% for .NET / .NET Core applications. It provides server-side features to support cache persistence and there are a lot of configurations that can be made to use cache persistence as required. Data can be persisted from cache to any database of our choice. NCache caches application data and removes performance bottlenecks related to your data storage and databases. It enables you to store your data in the cache for longer periods of time to make sure your data is available when you need it. NCache persistence datastore eliminates the need to move data from the database to the cache every time the cache starts. This ensures the high availability of your data without the need of writing extra code!Head over to NCache Docs to know more about how you can implement and use NCache persistent datastore along with your distributed cache.NCache Details Download NCache Edition Comparison Brad Rehman is proficient in a number of technologies including .NET, Java, C++, Python, and JavaScript and has leveraged this knowledge in applying software design to simulate Engineering solutions during his career. Brad has many years of energy industry experience delivering time-critical solutions and quality assurance activities
2025-04-05A great set of features and comes in three flavors – Open Source, Professional and Enterprise; which customers can choose from based on their needs. Do check out the editions while deciding which one to choose. fully supports caching in ASP.NET Core and provides its implementation of IDistributedCache which we can register and use it accordingly.Using NCache for Distributed Caching in ASP.NET CoreTo demonstrate how to connect and work with NCache for caching, let’s take the example of an API that returns a list of Items from a database. This Items API has two endpoints – one which returns a list of all the Items and another which returns a single Item by Id.We’ll integrate NCache as a caching tier for this API implementation and store frequently accessed items onto the cache.To keep things simple, I’ll use the ContainerNinja.API and integrate the caching tier over it. ContainerNinja.API project is a part of the ContainerNinja.CleanArchitecture boilerplate solution built using .NET 6 following industry best practices. You can find the boilerplate here – connect with NCache, first I’ll install the NCache caching extensions package into my Core layer (./ContainerNinja.Core/)> dotnet add package NCache.Microsoft.Extensions.Caching --version 5.1.0Then I’ll register the NCache DistributedCache into the IoC container, through which we can later access the caching service. I’ll place this inside the ServiceExtensions class inside the ContainerNinja.Core layer. We need to mention the cache name and other additional options as required.services.AddNCacheDistributedCache(configuration =>{ configuration.CacheName = "myCache"; configuration.EnableLogs = true; configuration.ExceptionsEnabled = true;});We can also externalize these configuration values using another overload of the same method as below:services.AddNCacheDistributedCache(configuration.GetSection("NCacheSettings"));where the section NCacheSettings is within the appsettings.json and is as below:{ --- other sections --- "NCacheSettings": { "CacheName": "mycache", "EnableLogs": "True", "RequestTimeout": "90" }}Observe that I haven’t mentioned any details about the NCache server to which the API needs to connect with. These settings are available inside the “client.ncconf” file I’ll place inside the API layer and is copied into the executables when deployed.I have my NCache cluster running in my local machine where the application is being run, so it by default looks into the NCache installation folder for client.nconf file.It looks like below: Using IDistributedCache service for accessing cacheTill now we have completed the connectivity part – I have the package installed and I got my client nconf file to connect to the cache.Now I need to integrate this cache into my business logic to insert and fetch from data as required.To demonstrate, let’s say I want to implement caching over GetItemById() API call where I query the database for a given itemId passed by the client.For this, I’ll inject the IDistributedCache service into the query handler class GetItemByIdQueryHandler (./ContainerNinja.Core/Handlers/Queries/) and add a condition on top of the database query, basically to –“check inside the cache and only if not available then query the database. And while returning the query results, store it inside the cache for a possible future hit”.The code looks like below:namespace ContainerNinja.Core.Handlers.Queries{ public class GetItemByIdQuery : IRequest { public int ItemId { get; }
2025-04-20NCache provides a Lucene module, which allows you to use Lucene for text searching with NCache. Each server of NCache has a dedicated Lucene module. This makes Lucene distributed, scalable, and highly available with NCache.NoteNCache uses the 4.8 version of Lucene.Net.Why to Use Lucene with NCache?Lucene, as we know, is a powerful and efficient search engine that providesa vast range of text-searching techniques to fulfill your business requirements. Lucene ismuch more than any other text search engine as the choices given to the user are multiple. It has powerful search algorithms and supports a wide range of queries for searching.Although as powerful as Lucene is on its own, it has its limitations. Lucene runs in-process in the client application. This means that Lucene isn't scalable, and it has a single point of failure.NCache provides a distributed implementation of Lucene with minor changes in its API. Lucene’s API calls NCache at the backend. NCache being distributed in nature with Lucene provides linear write scalability as the documents indexed by the applications are automatically distributed among cache nodes where they are separately indexed.NoteDistributed Lucene uses a separate and dedicated Lucene store instead of the NCache cache-store.Similarly, Distributed Lucene also provides linear read scalability since queries are propagated on each partition and results are merged. A higher number of partitions provides a higher amount of read and write scalability. Lucene indexes are persisted on your physical drive. The more nodes, the higher the scalability, performance, and storage capacity to accommodate a large number of Lucene documents and indexed data.Working of Distributed LuceneImportantIt's highly encouraged that you use an SSD to index and search Lucene documents instead of an HDD.The behavior and working of Lucene and Distributed Lucene are almost the same with a few changes. The workflow, data distribution, and components of Distributed Lucene are explained in the following sections:Distributed Lucene WorkflowThe diagram below shows how the Distributed Lucene model works.The client application may want to index and analyze (analyzed by supported Lucene analyzers) documents or query existing indexed documents by using the Lucene API. These operations with the API act like Remote
2025-04-21