在zendFramework项目中使用Redis缓存PHP的数组
时间:2021-07-01 10:21:17
帮助过:92人阅读
- $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);
|