• 欢迎 游客 您的光临,下载之前请先阅读 积分规则(暂行) 。任何技术问题请在论坛提问,本站定制插件、模板主题售前、售后问题请联系QQ:5916171

已解决 PHP的各种缓存该如何添加?

香草大叔

联合国秘书长
UID
48
注册
2017/11/27
消息
72
反馈评分
21
黄金
3,313.6G
    Windows 10 Chrome 76.0.3809.100
  • #1
如图所示,我想添加redis和Memcached 缓存
1565500428765.png
但是不知道该如何操作,有没有文档,或者大家交流一下
 

死了算了

管理成员
UID
1
注册
2017/07/28
消息
1,303
反馈评分
5,266
黄金
125,419.9G
服务器安装redis php扩展安装redis
然后安装 Redis Cache 插件 https://www.cnxfans.com/resources/178/
修改配置文件src/congfig.php

末尾加入

PHP:
// setup redis caching
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'SV\RedisCache\Redis';
// all keys and their defaults
$config['cache']['config'] = array(
        'server' => '127.0.0.1',
        'port' => 6379,
        'timeout' => 2.5,
        'persistent' => null,
        'force_standalone' => false,
        'connect_retries' => 1,
        'read_timeout' => null,
        'password' => null,
        'database' => 0,
        'compress_data' => 1,
        'lifetimelimit' => 2592000,
        'compress_threshold' => 20480,
        'compression_lib' => null, // dynamically select first of; snappy,lzf,l4z,gzip IF EMPTY/null
        'use_lua' => true,
        'serializer' => 'igbinary', // to disable set ot 'php'
        'retry_reads_on_master' => false,
        // HA support
        'load_from_slave' => null, // config entry similar to $config['cache']['config'], except without HA options
        'load_from_slaves' => null, // config entry similar to $config['cache']['config'], except without HA options
        'sentinel_master_set' => null,
        'sentinel_persistent' => null,
        );
// single slave (has most of the details of config):
$config['cache']['config']['load_from_slave'] = array(
        'server' => '127.0.0.1',
        'port' => 6378,
        );

// minimal case for sentinel support (aka HA)
$config['cache']['config']['sentinel_master_set'] = 'mymaster';
$config['cache']['config']['server'] = '127.0.0.1:26379';
$config['cache']['config']['load_from_slaves'] = false; // send readonly queries to the slaves
$config['cache']['config']['sentinel_persistent'] = null; // persistent connection option for the sentinel, but not the master/slave

// minimal case
$config['cache']['config'] = array(
        'server' => '127.0.0.1',
        'port' => 6379,
        );
$config['pageCache']['enabled'] = true;


我是这样添加的,如有其它欢迎讨论。
 
顶部 底部