• Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Try NCache
  • Contact Us
Try NCache
Show / Hide Table of Contents

Method GetByTag

GetByTag<T>(Tag)

Gets all the cached items with the specified tag.

Declaration
IDictionary<string, T> GetByTag<T>(Tag tag)
Parameters
Type Name Description
Tag tag

Name of tag to search the cache items with.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, T>

Returns a dictionary containing the cache keys and associated objects with the type specified.

Type Parameters
Name Description
T

Specifies the type of value obtained from the cache.

Examples

The following example demonstrates how to get the objects with the specified tag.

ICache cache = CacheManager.GetCache("demoCache");
Tag tag = new Tag("Sports");
IDictionary<string,Product> result = cache.SearchService.GetByTag<Product>(tag);

GetByTag<T>(String)

Gets all the cached objects with the wild card supported tag.

Declaration
IDictionary<string, T> GetByTag<T>(string wildCardExpression)
Parameters
Type Name Description
System.String wildCardExpression

The wild card Expression to search with.

Returns
Type Description
System.Collections.Generic.IDictionary<System.String, T>

Returns a dictionary containing the cache keys and associated objects with the type specified.

Type Parameters
Name Description
T

Specifies the type of value obtained from the cache.

Remarks

The special characters supported in wild search by NCache are: 1) "*" : Used as a substitute for zero or more characters in the string. 2)"?" : Used as a substitute for a single character in the string.

Examples

The following example demonstrates how to get the objects with the specified tag using wildcard.

ICache cache = CacheManager.GetCache("demoCache");

Following tags are created and items are added in the cache with these tags

Tag[] tags = new Tag[3];
tags[0] = new Tag("Important Customers");
tags[1] = new Tag("East Coast Customers");
tags[2] = new Tag("West Coast Customers");

IDictionary<string, Customer> result = cache.SearchService.GetByTag<Customer>("*Customers");

Contact Us

PHONE

+1 214-619-2601   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Try NCache
Pricing
NCache Playground

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

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Terms of Use
  •  
  • Privacy Policy
  •  
  • Cookie Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
  • Facebook
  • Twitter
  • Youtube
  • LinkedIn
  • RSS