在Zend Framework中使用Redis做数据缓存,可极大的提高系统的响应速度,示范代码:
- $config = Zend_Registry::get('config');
- $host = $config->setting->redis->host;
- $port = $config->setting->redis->port;
- $redis = new Redis();
- $redis->connect($host, $port) or die("connect to redis error\n");
- $redis->auth($config->setting->redis->password) or die("auth failed\n");
- $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
阅读(3804) | 评论(0) | 转发(0) |