get all keys and values

90 views
Skip to first unread message

blumenkraft

unread,
Feb 11, 2010, 8:57:01 AM2/11/10
to memcachedb
Hi,

Is it possible to get all keys and values from MemcacheDB?

Steve Chu

unread,
Feb 11, 2010, 9:15:09 AM2/11/10
to memca...@googlegroups.com
you may use rget command, but because rget is not part of memcache
protocol, so you need patched client library.

It is handy for python, there is a memcache.py in distribution that
support rget.

Here's a sample script that uses rget to traversal MemcacheDB:

mc = memcache.Client(['127.0.0.1:21201'], debug=0)
start_key = "0"
item_list = []
item_list_slice = []
while True:
item_list_slice = mc.rget(start_key, "z", 1, 0, 100)
if item_list_slice == []:
break
else:
item_list += item_list_slice
start_key = item_list_slice[-1][0]
mc.disconnect_all()


On Thu, Feb 11, 2010 at 9:57 PM, blumenkraft <voh...@gmail.com> wrote:
> Hi,
>
> Is it possible to get all keys and values from MemcacheDB?
>

> --
> You received this message because you are subscribed to the Google Groups "memcachedb" group.
> To post to this group, send email to memca...@googlegroups.com.
> To unsubscribe from this group, send email to memcachedb+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/memcachedb?hl=en.
>
>

--
Best Regards,

Steve Chu
http://stvchu.org

blumenkraft

unread,
Feb 11, 2010, 10:47:26 AM2/11/10
to memcachedb
Great, it works, thanks.

On Feb 11, 5:15 pm, Steve Chu <stv...@gmail.com> wrote:
> you may use rget command, but because rget is not part of memcache
> protocol, so you need patched client library.
>
> It is handy for python, there is a memcache.py in distribution that
> support rget.
>
> Here's a sample script that uses rget to traversal MemcacheDB:
>
>   mc = memcache.Client(['127.0.0.1:21201'], debug=0)
>   start_key = "0"
>   item_list = []
>   item_list_slice = []
>   while True:
>     item_list_slice = mc.rget(start_key, "z", 1, 0, 100)
>     if item_list_slice == []:
>       break
>     else:
>       item_list += item_list_slice
>       start_key = item_list_slice[-1][0]
>  mc.disconnect_all()
>

> On Thu, Feb 11, 2010 at 9:57 PM, blumenkraft <vohs...@gmail.com> wrote:
> > Hi,
>
> > Is it possible to get all keys and values from MemcacheDB?
>
> > --
> > You received this message because you are subscribed to the Google Groups "memcachedb" group.
> > To post to this group, send email to memca...@googlegroups.com.
> > To unsubscribe from this group, send email to memcachedb+...@googlegroups.com.

> > For more options, visit this group athttp://groups.google.com/group/memcachedb?hl=en.

Reply all
Reply to author
Forward
0 new messages