How to use the redis.saveClient.keys function in redis

To help you get started, we’ve selected a few redis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pilif / tempalias / garbage_collect.js View on Github external
function prune_rate_limits(){
  redis.keys('lock:*', function(locks){
    var i = 0, garbage = [], gc=0;
    if (!locks){
      sys.puts("No locks found");
      redis.close();
      return;
    }
    for (i = 0; i < locks.length; i++){
      (function(lockset){
        redis.get(lockset, function(exp){
          gc++;
          if (exp < (new Date()).getTime()){
            garbage.unshift(lockset);
          }
          if (gc >= locks.length){
            if (garbage.length > 0){
              sys.puts("Pruning: "+garbage.join(', '));
github pilif / tempalias / garbage_collect.js View on Github external
function prune_aliases(){
  redis.keys('aliases:*', function(data){
    var i, aid, qc = 0, garbage = [];
    if (!data){
      sys.puts('No aliases found');
      prune_rate_limits();
      return;
    }

    for (i = 0; i < data.length; i++){
      (function(aid){
        p.findById(aid.substr(8, aid.length), false, function(alias){
          qc++;
          if (!alias){
            garbage.unshift(aid);
            garbage.unshift('counter:'+aid.substr(8, aid.length));
          }