Redis

Implements the CacheInteface using as redis.io <http://www.redis.io as the cache backend.

Requires REDIS extension.

__construct

__construct($host, $port, $timeout)
$host:Point to the host where redis is listening for connections. This parameter may also specify other transports like unix:///path/to/redis.sock to use UNIX domain sockets - default 127.0.0.1.
$port:Point to the port where redis is listening for connections - default 6379.
$timeout:Value in seconds which will be used for connecting to the daemon. Think twice before changing the default value of 1 second - you can lose all the advantages of caching if your connection is too slow.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?php

 require_once 'dalmp.php';

 $cache = new DALMP\Cache\Redis('10.10.10.13', 6379);

 $cache->set('mykey', 'xpto', 300);

 $cache->get('mykey');

 $cache->X()->HSET('myhash', 'field1', 'hello'):

 $cache->X()->HGET('myhash', 'field1');

 $cache->X()->HGETALL('myhash');

See also

Cache Examples.

Thanks Navicat for supporting Open Source projects.

Navicat



A great amount of time has been spent creating, crafting and maintaining this software, please consider donating.

Donating helps ensure continued support, development and availability.

dalmp


comments powered by Disqus