Try Playground
Show / Hide Table of Contents

Tags Properties and Usage Overview

Tags are string-based identifiers that can be used to associate keywords (metadata) with your cache items. You can mark your data with these keywords and later retrieve or remove your cache items with the help of these keyword(s). For instance, in a store's product information library, the user wants to categorize the products according to the Date of Manufacture and Country of Production. All these keywords depict information based on which the products can be categorized.

Important

NCache now also provides support for wildcard searching of tags.

Why to Use Tags

Using tags can help the user associate keywords with cache items so the user can easily access the relevant data. The advantages of using tags include providing the user with a high level of relevance with the particular type. Moreover, the tagged data makes it easier for the user to locate the bookmarked data which improves efficiency, reduces time consumption, and reduces network trips which makes it cost-effective. It is a helpful approach if the user wants to organize data.

When to Use Tags

Let's suppose your cache contains the data of a large number of customers. Because the data is present in a large number, every time the user wants a particular item, the whole cache will be searched for it. Using tags, the data can be tagged with various identifiers which can later be used to get the data associated with that tag.

The table below contains the data of customers and a tag East Coast Customers is added with the customers belonging to the East Coast region and West Coast Customers for the customers of the West Coast region.

Furthermore, the data is categorized based on the priority of customers. There may be a few important customers belonging to either of the regions, so an additional tag of Important Customers is added with them.

Using Tags in NCache

There are customers with only one tag as well as customers with more than one tags. For example, the customer with CustomerID ALFKI contains the tag East Coast Customers and tag Important Customers. Whereas the customer with CustomerID BOLID contains only one tag, i.e., West Coast Customers.

Flexibility for Fetching Data with Tags

NCache provides four ways of fetching data based on the tags.

1. With ONLY One Tag

The data is fetched based on the tag provided. A single tag is provided and all the data associated with that tag will be fetched. For example, in order to fetch the customers belonging to the East Coast region, the tag East Coast Customers is provided.

2. With ANY One Tag

This API is used when more than one tag is provided and the data matching ANY of the provided tags is fetched. For example, providing the tags Important Customers, East Coast Customers, and West Coast Customers, the data of customers containing both of the tags will be retrieved.

3. With ALL Tags

This API is used when more than one tag is provided and the data matching ALL of the given tags is fetched. For example, by providing the tags Important Customers and East Coast Customers, the data of customers containing both of the tags will be retrieved.

4. With Wildcard Characters

Since tags are string-based identifiers, NCache provides the flexibility of searching data with specific patterns on the string, i.e., data is retrieved based on wildcard searching. A wildcard allows you to search for strings containing or starting/ending with any characters.

For example, searching the cache with tag Customers will retrieve all the customers with tags East Coast Customers, West Coast Customers, and Important Customers. If the cache is searched with the tag ??st Coast Customers, all the items with the tags East Coast Customers and West Coast Customers are retrieved. The special characters supported in wild search by NCache are:

  • *: Used as a substitute for zero or more characters in the string.

  • ?: Used as a substitute for a single character in the string.

Properties of Tags

  • 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. The number of tags can be infinite.

  • Support for Wildcard Search
    NCache now provides support for searching tags with wildcard expressions.

  • 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 lets you associate one or more tags with a single item.

  • Case Sensitive
    Tags are case insensitive.

  • Query Using Tags
    NCache also supports tags in queries.

Comparison Between Tags and Groups

Tags as well as groups have the same primary functionality of providing partitioning of data based on certain criteria. Groups provides logical partitioning of data in a hierarchical way.

However, tags have a few advantages over groups, making them more efficient. A single item can have multiple qualities/attributes associated with them in the form of tags. If you employ both features, make sure to keep them unique.

The following table shows the comparison between the functionalities of groups and tags.

Tags Groups
Provided in the form of an array of tags Provided in the form of string
String based only String based only
An item can have infinite number of tags An item have can only one group               
Independent of other tags Independent of other groups

See Also

Retrieve Cache Data with Tags
Remove Cache Data with Tags
Search Tag Data in Cache with SQL
Delete Tag Data from Cache with SQL
Use Groups for Logical Data Grouping
Named Tags with Cache Data

In This Article
  • Why to Use Tags
  • When to Use Tags
  • Flexibility for Fetching Data with Tags
  • Properties of Tags
  • Comparison Between Tags and Groups
  • 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