Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

C # memcached cache method steps for getting all cache keys

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the "c # memcached cache to get all the cache keys of the method steps", the article explained the content is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "c # memcached cache access to all cache keys method steps" bar!

Working with components

Memcached 1.2.6

.net class library memcacheddotnet_clientlib-1.1.5

1. Add memcacheddotnet_clientlib-1.1.5 code

After downloading the component, open the .net class library memcacheddotnet_clientlib-1.1.5 with vs, open MemCachedClient.cs, and add the following methods:

The copy code is as follows:

Public Hashtable Stats (ArrayList servers, string command)

{

/ / get SockIOPool instance

SockIOPool pool = SockIOPool.GetInstance (_ poolName)

/ / return false if unable to get SockIO obj

If (pool = = null)

{

/ / if (log.IsErrorEnabled)

/ / {

/ / log.Error (GetLocalizedString ("unable to get socket pool"))

/ /}

Return null

}

/ / get all servers and iterate over them

If (servers = = null)

Servers = pool.Servers

/ / if no servers, then return early

If (servers = = null | | servers.Count 1)

{

Int itemID = 0

If (tmpArr [1] = = "_") continue

Int.TryParse (tmpArr [1], out itemID)

If (itemID 1)

{

If (tmpArr [1] = = "_ _")

{

Continue

}

Keys.Add (tmpArr [0])

}

}

}

Return keys

}

Call method

The copy code is as follows:

IList list = MemcachedManager.GetAllKeys ()

Foreach (var item in list)

{

Response.Write (item + "")

}

Thank you for reading, the above is the content of "the method and steps of getting all cache keys by c # memcached cache". After the study of this article, I believe you have a deeper understanding of the method and steps of getting all cache keys by c # memcached cache, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report