Skip to content

Instantly share code, notes, and snippets.

@foospidy
Last active February 25, 2019 13:37
Show Gist options
  • Select an option

  • Save foospidy/85ccd44a12e00d91ecf990e82ed5e033 to your computer and use it in GitHub Desktop.

Select an option

Save foospidy/85ccd44a12e00d91ecf990e82ed5e033 to your computer and use it in GitHub Desktop.
Example script to reset the value to 0 for all keys in Redis.
<?php
if($redis->connect($GLOBALS['REDIS_HOST'], $GLOBALS['REDIS_PORT'])) {
if($redis->auth($GLOBALS['REDIS_PASSWORD'])) {
$keys = $redis->keys('*');
foreach($keys as $key) {
$redis->set($key, 0);
}
} else {
error_log('Error authenticating to redis!');
}
} else {
error_log('Error connecting to redis!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment