Skip to content

Instantly share code, notes, and snippets.

@bka
Created February 8, 2017 15:23
Show Gist options
  • Save bka/9c0e70c5106322824bc694fb2af4abd1 to your computer and use it in GitHub Desktop.
Save bka/9c0e70c5106322824bc694fb2af4abd1 to your computer and use it in GitHub Desktop.
Dump content of redis
<?php
require __DIR__ . '/app/bootstrap.php';
/* $redis = new Credis_Client('redis'); */
$redis = new Credis_Client('localhost');
$i = 0;
$json = array();
foreach($redis->keys('*') as $key) {
$data = array();
$data['key'] = $key;
$data['ttl'] = $redis->ttl($key);
$data['value'] = bin2hex($redis->dump($key));
$json[$i] = $data;
$i++;
}
echo json_encode($json);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment