当前位置:Gxlcms > PHP教程 > 在zendFramework项目中使用Redis缓存PHP的数组

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

时间:2021-07-01 10:21:17 帮助过:92人阅读

  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);

人气教程排行