开发者

How this code works to add the cache value?

public static void Add<T>(T cacheObject, string keyName)
{
    HttpContext.Current.Cache.Insert(keyName, cacheObject, null, Cache.NoAbsoluteExpiration,
                开发者_JAVA百科                     TimeSpan.FromMinutes(30));
}

Hello friends I am new to asp.net my question is I have this code to Add the cache value.

my question is when i cal this methods two times.. it will have two keys? or it will overwrite previous one?

thanks


"This method will overwrite an existing cache item whose key matches the key parameter."

http://msdn.microsoft.com/en-us/library/9bawy15w.aspx


It will overwrite assuming you pass in the same keyname.


If you pass the same value to keyName, the old value will be overwritten.

If you pass a different value, a new entry will be created in the cache.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜