欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

在zend Framework项目中使用Redis缓存PHP的数组

程序员文章站 2022-05-10 10:52:11
...
  1. $config = Zend_Registry::get('config');
  2. $host = $config->setting->redis->host;
  3. $port = $config->setting->redis->port;
  4. $redis = new Redis();
  5. $redis->connect($host, $port) or die("connect to redis error\n");
  6. $redis->auth($config->setting->redis->password) or die("auth failed\n");
  7. $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
复制代码