Wednesday, August 22, 2012

NodeJs - Extract Keys from Memcache Server

Let's see how to extract keys from memcache server. And I have done a modification in Arnout Kazemier’s simple_cachedump.js and then improved the NodeJs responses by prior calculation of available number of keys.



Output:




Note: Please write your queries and suggestion as comment.

4 comments:

  1. Worked for me, except I had to make sure to parse the stats and itemSet[stats].number to int first otherwise memcached returned an error concerning an incorrect slab id format. I made the following change

    memcached.cachedump(itemSet.server, parseInt(stats),
    parseInt(itemSet[stats].number), function(err, response) {

    ReplyDelete
  2. Thanks...worked for me ..But I have one doubt in cachedump
    when I hit my url to get all keys the same keys are coming as twice instead of 200 it gives 400 keys.Why this happens to me?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Ideally, it won't possible to happen like. Because, Memcache is working as key-value pair. I guess, you have problem in your code. It may happens that your variable is not cleared.

      Delete