Property NamedTags
NamedTags
With Named Tags, the user is able to store additional information (of any type) required to query the object stored as string. Users are required to provide the list of named tags, each having two parameters, "key" (name of a tag) as string and "value" (assigned value) as any primitive type.
NCache then allows you to search your objects through these named tags. Named tags can be specified by using this property of CacheItem.
Declaration
public NamedTagsDictionary NamedTags { get; set; }
Property Value
Type | Description |
---|---|
NamedTagsDictionary | Represents a dictionary so that items can be grouped together and retrieved efficiently. |
Examples
The following example sets named tags of a CacheItem.
Product product = new Product();
product.Id = 1;
product.Name = "Chai";
CacheItem item = new CacheItem(product);
NamedTagsDictionary tags = new NamedTagsDictionary();
tags.Add("tag1", "alpha");
tags.Add("tag2", "beta");
item.NamedTags = tags;