Home >Backend Development >PHP Tutorial >Using Redis to cache PHP arrays in zend Framework project

Using Redis to cache PHP arrays in zend Framework project

WBOY
WBOYOriginal
2016-07-25 09:10:251241browse
  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 errorn");
  6. $redis->auth($config->setting->redis->password) or die("auth failedn");
  7. $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn