summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@qvister.se>2012-01-21 12:25:08 +0100
committerAnton Lindqvist <anton@qvister.se>2012-01-21 12:25:08 +0100
commit1e8be299b1c0f6385fb0536a6983147bd8ac029e (patch)
tree68946ea89ce54969753a3bb13739fffe09ce4613 /application/controllers
parent96db8f91c34c18119548cacc4692362f51e70407 (diff)
Added redis cache driver.
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/test_redis.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/application/controllers/test_redis.php b/application/controllers/test_redis.php
new file mode 100644
index 000000000..b84c652d7
--- /dev/null
+++ b/application/controllers/test_redis.php
@@ -0,0 +1,43 @@
+<?php
+class Test_redis extends CI_Controller
+{
+
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->load->library('unit_test');
+
+ $this->load->driver('cache', array('adapter' => 'redis'));
+ }
+
+ function index()
+ {
+ $this->unit->run($this->cache->redis->is_supported(), 'is_true');
+
+ $this->unit->run($this->cache->redis->save('foo', 'bar'), 'is_true');
+
+ $this->unit->run($this->cache->redis->get('foo'), 'bar');
+
+ $this->unit->run($this->cache->redis->delete('foo'), 'is_true');
+
+ $this->unit->run($this->cache->redis->save('foo', 'bar', 1800), 'is_true');
+
+ $this->unit->run(
+ $this->cache->redis->get_metadata('foo'),
+ array(
+ 'data' => 'bar',
+ 'expire' => time() + 1800
+ )
+ );
+
+ $this->unit->run($this->cache->redis->clean(), 'is_true');
+
+ $this->unit->run($this->cache->redis->get('foo'), 'is_false');
+
+ $this->unit->run($this->cache->redis->cache_info(), 'is_array');
+
+ echo $this->unit->report();
+ }
+
+} \ No newline at end of file