<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ``` <?php /** * Created by PhpStorm. * User: jc * Date: 2018/7/5 * Time: 13:33 */ namespace Common\Logic; class RedisLogic extends BaseLogic { public $handler; public $options; public function __construct($options = array()) { if (!extension_loaded('redis')) { E(L('_NOT_SUPPORT_') . ':redis'); } $redis_host = D("Common/Config")->where(['cfg_name'=>'redis_host'])->find(); $redis_host = $redis_host['cfg_data'] ? $redis_host['cfg_data'] : '127.0.0.1'; $redis_port = D("Common/Config")->where(['cfg_name'=>'redis_port'])->find(); $redis_port = $redis_port['cfg_data'] ? $redis_port['cfg_data'] : '6379'; $redis_passwd = D("Common/Config")->where(['cfg_name'=>'redis_passwd'])->find(); $redis_passwd = $redis_passwd['cfg_data'] ? $redis_passwd['cfg_data'] : ''; $options = array( 'host' => $redis_host ? $redis_host : C('REDIS_HOST') , 'port' => $redis_port ? $redis_port : C('REDIS_PORT'), 'password' => $redis_passwd ? $redis_passwd :C('REDIS_PASSWORD') , 'timeout' => C('DATA_CACHE_TIMEOUT') ?: false, 'persistent' => false, ); $this->options = $options; $this->options['expire'] = isset($options['expire']) ? $options['expire'] : C('DATA_CACHE_TIME'); $this->options['prefix'] = isset($options['prefix']) ? $options['prefix'] : C('DATA_CACHE_PREFIX'); $this->options['length'] = isset($options['length']) ? $options['length'] : 0; $func = $options['persistent'] ? 'pconnect' : 'connect'; $this->handler = new \Redis; false === $options['timeout'] ? $this->handler->$func($options['host'], $options['port']) : $this->handler->$func($options['host'], $options['port'], $options['timeout']); if ('' != $options['password']) { $this->handler->auth($options['password']); } } /** * 讀取緩存 * @access public * @param string $name 緩存變量名 * @return mixed */ public function getVa($name) { //N('cache_read', 1); $value = $this->handler->get($this->options['prefix'] . $name); //$jsonData = json_decode($value, true); return (null === $value) ? '' : $value; //檢測是否為JSON數據 true 返回JSON解析數組, false返回源數據 } /** * 寫入緩存 * @access public * @param string $name 緩存變量名 * @param mixed $value 存儲數據 * @param integer $expire 有效時間(秒) * @return boolean */ public function setVa($name, $value, $expire = null) { N('cache_write', 1); if (is_null($expire)) { $expire = $this->options['expire']; } $name = $this->options['prefix'] . $name; //對數組/對象數據進行緩存處理,保證數據完整性 $value = (is_object($value) || is_array($value)) ? json_encode($value) : $value; if (is_int($expire) && $expire) { $result = $this->handler->setex($name, $expire, $value); } else { $result = $this->handler->set($name, $value); } if ($result && $this->options['length'] > 0) { // 記錄緩存隊列 //$this->queue($name); } return $result; } /** * 刪除緩存 * @access public * @param string $name 緩存變量名 * @return boolean */ public function rm($name) { return $this->handler->delete($this->options['prefix'] . $name); } /** * 清除緩存 * @access public * @return boolean */ public function clear() { return $this->handler->flushDB(); } } ````
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看