Try Playground
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) 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 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top