<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://briansnelson.com/index.php?action=history&amp;feed=atom&amp;title=Memcached_List_all_Keys</id>
		<title>Memcached List all Keys - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://briansnelson.com/index.php?action=history&amp;feed=atom&amp;title=Memcached_List_all_Keys"/>
		<link rel="alternate" type="text/html" href="https://briansnelson.com/index.php?title=Memcached_List_all_Keys&amp;action=history"/>
		<updated>2026-06-04T07:10:07Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://briansnelson.com/index.php?title=Memcached_List_all_Keys&amp;diff=858&amp;oldid=prev</id>
		<title>Brian: Created page with &quot;==Memcached List all Keys==  In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1M...&quot;</title>
		<link rel="alternate" type="text/html" href="https://briansnelson.com/index.php?title=Memcached_List_all_Keys&amp;diff=858&amp;oldid=prev"/>
				<updated>2015-08-22T14:43:24Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Memcached List all Keys==  In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1M...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Memcached List all Keys==&lt;br /&gt;
&lt;br /&gt;
In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1Meg of keys, which is usually enough during development.&lt;br /&gt;
&lt;br /&gt;
===Connect to your Memcached Instance===&lt;br /&gt;
&lt;br /&gt;
We have multiple ways to set up memcache instances (tcp or socket)&lt;br /&gt;
&lt;br /&gt;
====Connect to Memcached TCP Instance====&lt;br /&gt;
&lt;br /&gt;
 telnet 127.0.0.1 11211&lt;br /&gt;
&lt;br /&gt;
====Connect to Memcached Socket Instance ====&lt;br /&gt;
&lt;br /&gt;
 nc -U /path/to/socket&lt;br /&gt;
&lt;br /&gt;
===Now we need to get the slab ids===&lt;br /&gt;
&lt;br /&gt;
List the items to get the slab id:&lt;br /&gt;
&lt;br /&gt;
 stats items&lt;br /&gt;
&lt;br /&gt;
 STAT items:5:number 2&lt;br /&gt;
 STAT items:5:age 1390736&lt;br /&gt;
 STAT items:5:evicted 0&lt;br /&gt;
 STAT items:5:evicted_nonzero 0&lt;br /&gt;
 STAT items:5:evicted_time 0&lt;br /&gt;
 STAT items:5:outofmemory 0&lt;br /&gt;
 STAT items:5:tailrepairs 0&lt;br /&gt;
 STAT items:6:number 260&lt;br /&gt;
 STAT items:6:age 1385409&lt;br /&gt;
 STAT items:6:evicted 0&lt;br /&gt;
 STAT items:6:evicted_nonzero 0&lt;br /&gt;
 STAT items:6:evicted_time 0&lt;br /&gt;
 STAT items:6:outofmemory 0&lt;br /&gt;
 STAT items:6:tailrepairs 0&lt;br /&gt;
&lt;br /&gt;
The first number after ‘items’ is the slab id. Request a cache dump for each slab id, with a limit for the max number of keys to dump:&lt;br /&gt;
&lt;br /&gt;
 stats cachedump 3 100&lt;br /&gt;
 ITEM views.briansnelson.cache.cache_header..cc7d9 [6 b; 1256056128 s]&lt;br /&gt;
 END&lt;br /&gt;
&lt;br /&gt;
 stats cachedump 22 100&lt;br /&gt;
 ITEM views.briansnelson.cache.cache_page..8427e [7736 b; 1256056128 s]&lt;br /&gt;
 END&lt;br /&gt;
&lt;br /&gt;
Now you should be able to list and view the keys&lt;/div&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	</feed>