Tagging Data in NCache
Using Tags, you can associate keywords(s) with your cache items. You can mark your data with tags which act as identifiers for your cache items. For instance, in an online library there are different genres of books. For each different category a tag identifier can be added, along with tags for authors and year of publication. Note here that a single author can have two books written under two different categories. Moreover, multiple authors may have a publication in the same year, thus cache search can be made for each tag filter separately i.e. for all publications in year 2000 or for all publications of John Keats. Also, these filter tags can be used in combination with each other like all publications of John Keats in year 2000.
Retrieve/Remove using Tags
These identifying marks can help you in finding and/or removing items from the
cache.
Support for Multiple Tags
You can tag more than one keyword with any cache item.
Many-to-Many Grouping
Tags provide a many-to-many grouping where one tag can contain multiple cached
items and one cached item can belong to multiple tags. NCache provides you with
Tag class in which you can specify one or more tags associated with cached
items.
Case Sensitive
Tags are case sensitive.
Query using Tags NCache also supports tags in queries.
For example, if you tag your cache item with a list of tags i.e. “bookinformation” having tags like "author", "yearofpublication" and "category", you can fetch items through API which match
with ANY one tag (e.g. book where author or yearofpublication or category is matched) from the list, or
with ALL tags (e.g. book where author and yearofpublication and category are matched), or
with ONLY one tag (only author is a match).
You can also remove items from cache on the basis of these marks of identification. You can use the same filters of tags for removal of items. You can use these different filters according to your business needs.
In This Section
Creating Tags
Describes how tags can be created using Tag API.
Adding Items to Cache with Tags
Explains how tagged items can be added to cache.
Retrieving Previously Tagged Data
Explains how existing tagged data can be fetched from the cache.
Removing Items from Cache containing Tags
Explains how existing tagged items can be removed from the cache.