Named Tags Properties and Usage Overview
Note
This feature is only available in NCache Enterprise Edition.
Named Tags is a feature provided by NCache which is an enhanced form of Tags. They associate particular information with the items in the form of key-value pair at runtime. In case of tags, the keyword(s) associated to a cache item must be string based identifiers. The advantage of named tags over tags is that they do not have this condition for the identifiers to hold a specific data type whereas in tags and groups the data type can only be string.
Using named tags the user can provide a name as well as a value in order to bookmark a cache item and they are independent of data types. Hence, the user is able to store additional information of any primitive type along with the cache item and use it later for further operations. Following is the list of supported primitive data types.
int
long
float
double
char
string
decimal
bool
DateTime
The key role tags or named tags play in a cache is providing high relevance with the data and make it easy for the user to access the data set based on the keyword(s). Moreover using tags or named tags; indexes can be defined by the user at runtime which improves performance and accessibility.
When to Use Named Tags
Let's suppose there is a company having data of all customers, products or orders in a large database. The attributes of products include ProductID, ProductName, or Category. The company has a flash sale on some items for a day which categorize a particular set of data based on this discount. Instead of adding an attribute to the class and then removing that later, the user can add Named Tag to those products which hold the discount.
This way the user can append this information to the existing class
of Products
at runtime; instead of adding a whole new attribute to the class. Considering the given scenario the named tags added to the class Product
may have named tags where the
name of the tag can be FlashSaleDiscount and the value of this tag depicts that the product will have a 50% discount; so the value can be 0.5.
Following diagram depicts the whole scenario visually.
Here users are required to provide the list of named tags, each having two parameters, "key" (name of a tag) as string and "value" (assigned value) as any primitive type. NCache then allows you to search your objects through these named tags.
Properties of Named Tags
Retrieve/Remove using Named Tags
These identifying marks can help you in finding and/or removing items from the cache.
Support for Multiple Named Tags
You can add more than one key-value pairs in Named Tags with any cache item.
Many-to-Many Grouping
Like Tags, Named Tags provide a many-to-many grouping where one tag can contain multiple cached items and one cached item can belong to multiple tags.
Case Sensitive
Named Tags are case insensitive.
Querying Data using Named Tags
NCache supports Named Tags in queries.
Comparison Between Groups, Tags and Named Tags
Following table shows the comparison between the functionalities of groups, tags and Named Tags.
Named Tags | Tags | Groups |
---|---|---|
Provided in the form of a dictionary | Provided in the form of an array of tags | Provided in the form of string |
Can be of any primitive data type | String based only | String based only |
See Also
Add Cache Data with Named Tags
SQL Query with NamedTags
SQL Delete with NamedTags
Data Expiration
Tag Cache Data