Remove Cache Data with Group
This feature is only available in NCache Enterprise.
NCache allows the user to remove the items with the data groups. It also allows the user to remove the data group with
To remove cache items that belong to a specific group, the
RemoveGroupData method can be used. This method removes all the cache items mapped under the group passed to this API.
- Passing empty strings for the group will return an empty result set.
- Passing null for the group will throw an
- Passing only the value of the group will remove all the cache items mapped under the group.
The following example removes the data under the group West Coast Customers.
// Preconditions: Cache is already connected // A user wants to remove a customer from West Coast Region // Items are previously added in the cache with the group 'West Coast Customers' string groupName = "West Coast Customers"; // Cache items belonging to the group are removed from the cache cache.SearchService.RemoveGroupData(groupName);
To ensure the operation is fail-safe, it is recommended to handle any potential exceptions within your application, as explained in Handling Failures.
NCache provides a sample application for Groups on GitHub.