diff --git a/.devilbox/www/htdocs/db_redis.php b/.devilbox/www/htdocs/db_redis.php index 5c07cf92..532de888 100644 --- a/.devilbox/www/htdocs/db_redis.php +++ b/.devilbox/www/htdocs/db_redis.php @@ -1,5 +1,12 @@ authPage(); ?> +flushDB($_GET['redisdb']); + loadClass('Helper')->redirect('/db_redis.php'); +} +?> @@ -15,6 +22,27 @@

+ getKeys()); ?> + +
+
+
+
+ + +
   + +
+
+
+
+ +
@@ -22,29 +50,43 @@

Redis container is not running.

- - - - - - - - getKeys() as $db_name => $keys): ?> - - + - - $val): ?> - - - - + + + + + + + + - + + + + + + + + + - + + +

No keys set.

+
DBKeyValue
- + getKeys(); ?> + + $keys): ?> +
+ Database:      + Items: +
DBKeyExpiresTypeValue
s + + + +
diff --git a/.devilbox/www/include/lib/container/Memcd.php b/.devilbox/www/include/lib/container/Memcd.php index bf4e7eb1..9aff5844 100644 --- a/.devilbox/www/include/lib/container/Memcd.php +++ b/.devilbox/www/include/lib/container/Memcd.php @@ -67,8 +67,6 @@ class Memcd extends BaseClass implements BaseInterface $this->_connect_errno = 3; return; } - - $memcd->set('devilbox-version', $GLOBALS['DEVILBOX_VERSION'].' ('.$GLOBALS['DEVILBOX_DATE'].')'); $this->_memcached = $memcd; } else { diff --git a/.devilbox/www/include/lib/container/Redis.php b/.devilbox/www/include/lib/container/Redis.php index e2f142b5..7633185f 100644 --- a/.devilbox/www/include/lib/container/Redis.php +++ b/.devilbox/www/include/lib/container/Redis.php @@ -47,7 +47,6 @@ class Redis extends BaseClass implements BaseInterface if (array_key_exists('pass', $data)) { $redis->auth($data['pass']); } - $redis->set('devilbox-version', $GLOBALS['DEVILBOX_VERSION'].' ('.$GLOBALS['DEVILBOX_DATE'].')'); $this->_redis = $redis; } } @@ -70,6 +69,17 @@ class Redis extends BaseClass implements BaseInterface * Select functions * *********************************************************************************/ + public function flushDB($db) + { + if ($this->_redis) { + if ( !$this->_redis->select($db) ) { + return FALSE; + } + return $this->_redis->flushDb(); + } else { + return FALSE; + } + } public function getInfo() { @@ -101,7 +111,35 @@ class Redis extends BaseClass implements BaseInterface $this->_redis->select($db); $keys = $this->_redis->keys('*'); foreach ($keys as $key) { - $store[$db][$key] = $this->_redis->get($key); + + switch($this->_redis->type($key)) { + case \Redis::REDIS_STRING: + $dtype = 'string'; + break; + case \Redis::REDIS_SET: + $dtype = 'set'; + break; + case \Redis::REDIS_LIST: + $dtype = 'list'; + break; + case \Redis::REDIS_ZSET: + $dtype = 'zset'; + break; + case \Redis::REDIS_HASH: + $dtype = 'hash'; + break; + case \Redis::REDIS_NOT_FOUND: + $dtype = 'other'; + break; + default: + $dtype = 'unknown'; + } + $store[$db][] = array( + 'name' => $key, + 'val' => $this->_redis->get($key), + 'type' => $dtype, + 'ttl' => $this->_redis->ttl($key) + ); } } }