放和标签 [英] Put and tags
问题描述
我需要更新缓存项目以及与之关联的标签。为此,我使用.Put方法,如下所示:
myDefaultCache.Put(key,obj,tags," Region");
我想知道如果标签已经存在,是否会再次创建标签。即这些更新的标签会替换该项目的现有标签吗?
有没有办法检索与缓存项目关联的标签?
- jagaurg
GetDataCacheItem函数可用于检索与项目关联的标签。更新对象后,还会替换与对象关联的标记。每个"put"在一个键上完全覆盖该键的对象,甚至是与
相关联的标签。
例如。比方说,跟随调用添加了一个标签,对象为"KEY1"
myDefaultCache.Put(" KEY1",obj,tags," Region");
如果您下次调用没有标记的put,那么它将替换(而不是删除)之前与该对象关联的所有标记。
myDefaultCache.Put(" KEY1",obj," Region");
Hi,
I need to update a cache item together with the tags associated with it. To do so, I use the .Put method as follows:
myDefaultCache.Put(key, obj, tags, "Region");
I wonder if tags will be created again if they already exist. i.e. would these updated tags replace existing tags for the item?
Is there a way to retrieve tags associated with a cache item?
-- jagaurg
GetDataCacheItem function can be used to retrieve tags associated with the item. And once you update the objects, tags associated with objects are also replaced. Each "put" on a key completely overwrite the object for that key, even tags associated with that.
E.g. lets say, following call added a tag with the object "KEY1"
myDefaultCache.Put("KEY1", obj, tags, "Region");
if you next call put without a tag, then it will replace(rather remove) all the tags previously associated with the object.
myDefaultCache.Put("KEY1", obj, "Region");
这篇关于放和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!