Try Playground
Show / Hide Table of Contents

Remove Existing Data Structure From Cache

You can remove an existing data structure from the cache using the Remove method of DataTypeManager or through the cache.Remove method as well. If the key does not exist, nothing is returned.

Prerequisites

  • .NET
  • Java
  • Python
  • Node.js
  • To learn about the standard prerequisites required to work with all NCache client-side features, please refer to the given page on Client-Side API Prerequisites.
  • For API details, refer to: ICache, DataTypeManager, Contains, Count, Remove.
  • To learn about the standard prerequisites required to work with all NCache client-side features, please refer to the given page on Client-Side API Prerequisites.
  • For API details, refer to: Cache, getDataStructuresManager, contains, getCount, remove.
  • To learn about the standard prerequisites required to work with all NCache client-side features, please refer to the given page on Client-Side API Prerequisites.
  • For API details, refer to: Cache, DatastructureManager, contains, getCount, remove.
  • To learn about the standard prerequisites required to work with all NCache client-side features, please refer to the given page on Client-Side API Prerequisites.
  • For API details, refer to: Cache, getDataStructuresManager, contains, getCount, remove.

Remove Data Structures from Cache

Tip

One quick way to verify whether the data structure has been removed is to use either property of the Cache class:

  • Contains verifies if the specified key exists in the cache.
  • Count returns the number of items present in the cache.

The following example assumes the key exists against a data structure in the cache. The data structure is then removed from the cache using this key.

  • .NET
  • Java
  • Python
  • Node.js
// Precondition: Cache is connected

// Key exists in cache
string key = "ProductIDList";

// Remove List from Cache
cache.DataTypeManager.Remove(key);
// Precondition: Cache is connected

// Key exists in cache
String key = "ProductIDList";

// Remove List from Cache
cache.getDataStructuresManager().remove(key);
# Precondition: Cache is connected
# Key exists in cache
key = "ProductIDList"

# Remove List from Cache
cache.get_data_structures_manager().remove(key)
// This is an async method
// Precondition: Cache is connected

// Key exists in cache
var key = "ProductIDList";

// Remove List from Cache
await this.cache.getDataStructuresManager().remove(key);
Note

To ensure the operation is fail-safe, it is recommended to handle any potential exceptions within your application, as explained in Handling Failures.

Additional Resources

NCache provides a sample application for removing data structures from cache on GitHub.

See Also

.NET: Alachisoft.NCache.Runtime.Caching namespace.
Java: com.alachisoft.ncache.runtime.caching namespace.
Python: ncache.runtime.caching class.
Node.js: NamedTagsDictionary class.

In This Article
  • Prerequisites
  • Remove Data Structures from Cache
  • Additional Resources
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top