Created
February 8, 2017 15:23
-
-
Save bka/9c0e70c5106322824bc694fb2af4abd1 to your computer and use it in GitHub Desktop.
Dump content of redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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