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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## PHP四大加速緩存器opcache,apc,xcache,eAccelerator eAccelerator,xcache,**opcache**(5.5默認 linux下安裝php時記得加上 --enable-opcache ),apc(偏數據庫緩存,分系統和用戶緩存,不推薦5.5將棄之,由opcache替代,apcu作為數據緩存獨立出來,在單臺服務器時性能優于memcachedd的,多臺不推薦)是PHP緩存擴展, memcached緩存是數據庫緩存擴展(APC比較偏向數據庫緩存的),一般兩者只有要安裝其中一個即可 注意:([詳情連接](https://www.chenweiliang.com/cwl-940.html)) 實際測試中發現當Cache數量超過一定閥值的時候,APC的性能不如Memcache opcache的性能優于其他幾個緩存器 **一般會選擇opcache+memcached|redis這個組合** 如果儲存的量不大,tp 的file 緩存,和redis |memcached差不多。但是內存讀取肯定要快。如果存儲的值多,redis |memcached強大的i/o能力會強于 普通的文件讀寫 # [使用 OpCache 提升 PHP 5.5+ 程序性能](https://www.cnblogs.com/chunguang/p/5538093.html)(從編譯層面提高) 作用是將PHP代碼預編譯生成的腳本文件?`Opcode`?緩存在共享內存中供以后反復使用,從而避免了從磁盤讀取代碼再次編譯的時間消耗 省去了每次加載和解析 PHP 腳本的開銷。同時,它還應用了一些代碼優化模式,使得代碼執行更快。從而加速PHP的執行(避免重復編譯,減少 CPU 和內存開銷) php.ini 打開 zend\_extension="D:\\phpStudy\\php\\php-7.2.14\\ext\\php\_opcache.dll" ~~~ [opcache] zend_extension = php_opcache.dll opcache.enable = 0 opcache.memory_consumption = 128 opcache.max_accelerated_files = 10000 opcache.revalidate_freq = 60 ; Required for Moodle opcache.use_cwd = 1 opcache.validate_timestamps = 1 opcache.save_comments = 1 opcache.enable_file_override = 0 ~~~ >[danger] 不要在編寫調試代碼中開啟opcache,否則你會體會到你的增刪改查不能即時同步的痛苦! 開啟后在第一次訪問php文件時候,自動編譯并緩存,如果想手動編譯緩存則使用下面的OPcache函數 # [**OPcache 函數**](https://www.php.net/manual/zh/ref.opcache.php) ## **opcache\_compile\_file**(string`$file`) :boolean 手動編譯并緩存php腳本,即無需運行,即可編譯并緩存 PHP 腳本 該函數可用于在 Web 服務器重啟之后初始化緩存,以供后續請求調用。 ## **opcache\_invalidate**(string`$file`\[,boolean`$force`\=**`FALSE`**\] ) :boolean 廢除php腳本的緩存 ## **opcache\_is\_script\_cached**(string`$file`) :bool 檢查指定php腳本是否存在于opcache緩存中 ## **opcache_reset**(void) :boolean 該函數將重置整個字節碼緩存。 在調用**opcache_reset()**之后,所有的腳本將會重新載入并且在下次被點擊的時候重新解析。 ## **opcache\_get\_configuration**(void) :array 返回緩存實例的配置信息。 返回內容如下: ``` array(3) { ["directives"]=> array(25) { ["opcache.enable"]=> bool(true) ["opcache.enable_cli"]=> bool(true) ["opcache.use_cwd"]=> bool(true) ["opcache.validate_timestamps"]=> bool(true) ["opcache.inherited_hack"]=> bool(true) ["opcache.dups_fix"]=> bool(false) ["opcache.revalidate_path"]=> bool(false) ["opcache.log_verbosity_level"]=> int(1) ["opcache.memory_consumption"]=> int(134217728) ["opcache.interned_strings_buffer"]=> int(8) ["opcache.max_accelerated_files"]=> int(4000) ["opcache.max_wasted_percentage"]=> float(0.05) ["opcache.consistency_checks"]=> int(0) ["opcache.force_restart_timeout"]=> int(180) ["opcache.revalidate_freq"]=> int(60) ["opcache.preferred_memory_model"]=> string(0) "" ["opcache.blacklist_filename"]=> string(0) "" ["opcache.max_file_size"]=> int(0) ["opcache.error_log"]=> string(0) "" ["opcache.protect_memory"]=> bool(false) ["opcache.save_comments"]=> bool(true) ["opcache.load_comments"]=> bool(true) ["opcache.fast_shutdown"]=> bool(true) ["opcache.enable_file_override"]=> bool(false) ["opcache.optimization_level"]=> int(4294967295) } ["version"]=> array(2) { ["version"]=> string(9) "7.0.4-dev" ["opcache_product_name"]=> string(12) "Zend OPcache" } ["blacklist"]=> array(0) { } } ``` ## **opcache\_get\_status**(\[boolean`$get_scripts`\=**`TRUE`**\] ) :array 返回緩存實例的狀態信息。 參數: `get_scripts`包含腳本的具體聲明信息。 返回內容大致如下 ``` array(8) { ["opcache_enabled"]=> bool(true) ["cache_full"]=> bool(false) ["restart_pending"]=> bool(false) ["restart_in_progress"]=> bool(false) ["memory_usage"]=> array(4) { ["used_memory"]=> int(10936144) ["free_memory"]=> int(123281584) ["wasted_memory"]=> int(0) ["current_wasted_percentage"]=> float(0) } ["interned_strings_usage"]=> array(4) { ["buffer_size"]=> int(8388608) ["used_memory"]=> int(458480) ["free_memory"]=> int(7930128) ["number_of_strings"]=> int(5056) } ["opcache_statistics"]=> array(13) { ["num_cached_scripts"]=> int(1) ["num_cached_keys"]=> int(2) ["max_cached_keys"]=> int(7963) ["hits"]=> int(0) ["start_time"]=> int(1410858101) ["last_restart_time"]=> int(0) ["oom_restarts"]=> int(0) ["hash_restarts"]=> int(0) ["manual_restarts"]=> int(0) ["misses"]=> int(1) ["blacklist_misses"]=> int(0) ["blacklist_miss_ratio"]=> float(0) ["opcache_hit_rate"]=> float(0) } ["scripts"]=> array(1) { ["/var/www/opcache.php"]=> array(6) { ["full_path"]=> string(17) "/var/www/opcache.php" ["hits"]=> int(0) ["memory_consumption"]=> int(1064) ["last_used"]=> string(24) "Tue Sep 16 09:01:41 2014" ["last_used_timestamp"]=> int(1410858101) ["timestamp"]=> int(1410858099) } } } ```
                  <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>

                              哎呀哎呀视频在线观看