系统的文件缓存不好用,能加入Redis或Memcached缓存吗?

魔皇   ·   发表于 2021-11-14   ·   技术交流

系统的文件缓存不好用,如果刷新缓存或在采集小说访问太慢了,不刷新缓存首页‘最近更新‘不自动更新,能加入Redis或Memcached缓存吗?和可以设置更新缓存时间

3 条回复   |  直到 2021-11-15 | 390 次浏览

wuqing
发表于 2021-11-14

程序没有修改thinkphp框架,thinkphp可以支持 Redis或Memcached缓存


config/cache.php 设置缓存


// redis缓存

return [

    // 驱动方式

    'type'   => 'Redis',

    // 服务器地址

    'host'       => '127.0.0.1',

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


// Memcache缓存

return [

    // 驱动方式

    'type'   => 'Memcached',

    // 服务器地址

    'host'       => '127.0.0.1',

    'port'       => 11211,

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


你可以试试这个我也没测试过具体有没有问题也不清楚


你采集无法打开页面是系统机制。其他人打开不受影响。你可以开两个不同的浏览器测试下。一个浏览器采集另一个打开。或是使用不同的设备测试。


评论列表

  • 加载数据中...

编写评论内容

魔皇
发表于 2021-11-15

wuqing

2021-11-14

程序没有修改thinkphp框架,thinkphp可以支持 Redis或Memcached缓存


config/cache.php 设置缓存


// redis缓存

return [

    // 驱动方式

    'type'   => 'Redis',

    // 服务器地址

    'host'       => '127.0.0.1',

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


// Memcache缓存

return [

    // 驱动方式

    'type'   => 'Memcached',

    // 服务器地址

    'host'       => '127.0.0.1',

    'port'       => 11211,

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


你可以试试这个我也没测试过具体有没有问题也不清楚


你采集无法打开页面是系统机制。其他人打开不受影响。你可以开两个不同的浏览器测试下。一个浏览器采集另一个打开。或是使用不同的设备测试。


刷新缓存后打开男生女生和排行页面太慢了,不刷新一下首页有无更新。我见其他系统用Memcached缓存的就没有这样,首页也定时刷新,我觉得加入Memcached好点

评论列表

  • 加载数据中...

编写评论内容

魔皇
发表于 2021-11-15

wuqing

2021-11-14

程序没有修改thinkphp框架,thinkphp可以支持 Redis或Memcached缓存


config/cache.php 设置缓存


// redis缓存

return [

    // 驱动方式

    'type'   => 'Redis',

    // 服务器地址

    'host'       => '127.0.0.1',

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


// Memcache缓存

return [

    // 驱动方式

    'type'   => 'Memcached',

    // 服务器地址

    'host'       => '127.0.0.1',

    'port'       => 11211,

    // 缓存前缀

    'prefix' => '',

    // 缓存有效期 0表示永久缓存

    'expire' => 0,

]; 


你可以试试这个我也没测试过具体有没有问题也不清楚


你采集无法打开页面是系统机制。其他人打开不受影响。你可以开两个不同的浏览器测试下。一个浏览器采集另一个打开。或是使用不同的设备测试。


我测试过了,如果刷新缓存一样是这样,虽然缓存后是快一点,但首次打开一样这么慢

评论列表

  • 加载数据中...

编写评论内容
登录后才可发表内容