<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ### 組件說明 > * Lying支持多種緩存,你可以定義一種緩存,或者同時定義多種緩存,只要ID不同就行。 > * 緩存的配置有默認值和選填的選項都是可以省略不寫的。 ### 示例配置 #### 文件緩存 配置選項: | 配置名 | 參數類型 | 可選 | 默認值 | 說明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\cache\FileCache | 可配置 | | dir | string | 是 | DIR_RUNTIME . DS . 'cache' | 緩存文件存放的目錄 | | gc | int | 是 | 50 | 垃圾清除的頻率,數值為0到100之間,越小回收的越頻繁 | | suffix | string | 是 | bin | 文件緩存的后綴名 | | serialize | bool | 是 | true | 是否對數據進行序列化 | 示例配置: ~~~php 'cache' => [ 'class' => 'lying\cache\FileCache', 'dir' => DIR_RUNTIME . DS . 'cache', //緩存文件存放的目錄,默認'runtime/cache' 'gc' => 50, //垃圾清除的頻率,數值為0到100之間,越小回收的越頻繁,默認50 'suffix' => 'bin', //文件緩存的后綴名 'serialize' => true, //是否對數據進行序列化 ], ~~~ #### Apcu緩存 配置選項: | 配置名 | 參數類型 | 可選 | 默認值 | 說明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\cache\ApcuCache | 可配置 | 示例配置: ~~~php 'apcu' => 'lying\cache\ApcuCache', ~~~ #### Memcached緩存 配置選項: | 配置名 | 參數類型 | 可選 | 默認值 | 說明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\cache\Memcached | 可配置 | | persistentId | string | 是 | null | 如果配置了此參數則會以長連接打開mencached | | servers | array | 是 | [['127.0.0.1', 11211, 1]] | Memcached服務器連接列表 | | username | string | 是 | '' | 用戶名 | | password | string | 是 | '' | 密碼 | | options | array | 是 | [] | 額外的memcached選項 | 示例配置: ~~~php 'Memcached' => [ 'class' => 'lying\cache\Memcached', 'persistentId' => false, //長連接ID,如果配置了此參數則會以長連接打開mencached 'servers' => [ ['127.0.0.1', 11211, 1], //Memcached服務器連接列表,選填,默認['127.0.0.1', 11211, 1] ], 'username' => '', //用戶名,選填 'password' => '', //密碼,選填 'options' => [], //額外的memcached選項 ], ~~~ #### 數組緩存 配置選項: | 配置名 | 參數類型 | 可選 | 默認值 | 說明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\cache\ArrayCache | 可配置 | 示例配置: ~~~php 'arraycache' => [ 'class' => 'lying\cache\ArrayCache', ], ~~~ * 數組緩存的生命周期是在一次請求里面,所以當請求結束后,里面的緩存數據會全部清空! ### 調用方式 ~~~php \Lying::$maker->get('cacheId'); \Lying::$maker->cache('cacheId'); \Lying::$maker->cacheId; ~~~ ### 方法列表 ~~~php /** * 添加一個緩存,如果緩存已經存在,此次設置的值不會覆蓋原來的值,并返回false * @param string $key 緩存的鍵 * @param mixed $value 緩存的數據 * @param int $ttl 緩存生存時間,默認為0 * @return bool 成功返回true,失敗返回false */ public function add($key, $value, $ttl = 0); ~~~ * * * * * ~~~php /** * 添加一組緩存,如果緩存已經存在,此次設置的值不會覆蓋原來的值 * @param array $data 一個關聯數組,如['name'=>'lying'] * @param int $ttl 緩存生存時間,默認為0 * @return array 返回設置失敗的數組,如['name', 'sex'],否則返回空數組 */ public function madd($data, $ttl = 0); ~~~ * * * * * ~~~php /** * 添加一個緩存,如果緩存已經存在,此次緩存會覆蓋原來的值并且重新設置生存時間 * @param string $key 緩存的鍵 * @param mixed $value 緩存的數據 * @param int $ttl 緩存生存時間,默認為0 * @return bool 成功返回true,失敗返回false */ public function set($key, $value, $ttl = 0); ~~~ * * * * * ~~~php /** * 添加一組緩存,如果緩存已經存在,此次緩存會覆蓋原來的值并且重新設置生存時間 * @param array $data 一個關聯數組,如['name' => 'lying'] * @param int $ttl 緩存生存時間,默認為0 * @return array 返回設置失敗的數組,如['name', 'sex'],否則返回空數組 */ public function mset($data, $ttl = 0); ~~~ * * * * * ~~~php /** * 從緩存中提取存儲的變量 * @param string $key 緩存的鍵 * @return mixed 成功返回值,失敗返回false */ public function get($key); ~~~ * * * * * ~~~php /** * 從緩存中提取一組存儲的變量 * @param array $keys 緩存的鍵數組 * @return array 返回查找到的數據數組,沒找到則返回空數組 */ public function mget($keys); ~~~ * * * * * ~~~php /** * 檢查緩存是否存在 * @param string $key 要查找的緩存鍵 * @return bool 如果鍵存在,則返回true,否則返回false */ public function exists($key); ~~~ * * * * * ~~~php /** * 從緩存中刪除存儲的變量 * @param string $key 從緩存中刪除存儲的變量 * @return bool 成功返回true,失敗返回false */ public function del($key); ~~~ * * * * * ~~~php /** * 清除所有緩存 * @return bool 成功返回true,失敗返回false */ public function flush(); ~~~
                  <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>

                              哎呀哎呀视频在线观看