Method GetByTags
GetByTags<T>(IEnumerable<Tag>, TagSearchOptions)
Returns the cached objects that have tags with specified TagSearchOptions.
Declaration
IDictionary<string, T> GetByTags<T>(IEnumerable<Tag> tags, TagSearchOptions type)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Tag> | tags | IEnumerable collection of tags to search cache with. |
TagSearchOptions | type | TagSearchOptions specifies the search type for the tags. |
Returns
Type | Description |
---|---|
IDictionary<System.String, T> | A dictionary containing cache keys and associated objects with the specified type. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of value obtained from the cache. |
Examples
The following example demonstrates how to get the objects that have the specified tags with TagSearchOptions.
ICache cache = CacheManager.GetCache("myCache");
Tag[] tags = new Tag[2];
tags[0] = new Tag("Alpha");
tags[1] = new Tag("Beta");
IDictionary<string, Product> result = cache.SearchService.GetByTags<Product>(tags,TagSearchOptions.ByAllTags);