Method GetKeysByTags
GetKeysByTags(IEnumerable<Tag>, TagSearchOptions)
Returns keys of the cached items that have tags with specified TagSearchOptions.
Declaration
ICollection<string> GetKeysByTags(IEnumerable<Tag> tags, TagSearchOptions type)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Tag> | tags | IEnumerable collection of tags to search cache with. |
TagSearchOptions | type | TagSearchOptions specifies the search type for the tags. |
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<System.String> | Returns collection containing the cache keys. |
Examples
The following example demonstrates how to get the keys that have the specified tags with TagSearchOptions.
ICache cache = CacheManager.GetCache("demoCache");
Tag[] tags = new Tag[2];
tags[0] = new Tag("Alpha");
tags[1] = new Tag("Beta");
ICollection<string> result = cache.SearchService.GetKeysByTags(tags, TagSearchOptions.ByAllTags);