Get the App
SLTechnology News&Howtos  ›  Development  › 

C # memcached cache method steps for getting all cache keys

Shulou Source: shulou.com Published: 2022-06-03 15:48:39 11月14日 Update

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!

Tags: Caching code methods steps caching parameters learning information content functions articles components services code downloads commands that is ideas situations data more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi Microsoft Linux Xiaomi