gpt4 book ai didi

redis - 带有 redis 的 phpspreadsheet 增加了运行时间

转载 作者:可可西里 更新时间:2023-11-01 11:23:34 29 4
gpt4 key购买 nike

当将缓存方法设置为 redis 时,它似乎会增加加载电子表格和读取等的运行时间。

在我使用 PHPSpreadsheet 类的任何部分之前,我运行以下命令

    if(CACHE_ON){
$client = new \Redis();
$client->connect(CACHE_HOST, 6379);
$pool = new \Cache\Adapter\Redis\RedisCachePool($client);
$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);
\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache);
}
//...
try {
$fileType = IOFactory::identify($uploadFile);
} catch(\PhpOffice\PhpSpreadsheet\Reader\Exception $e) {
$message = 'Input file is not an Excel Workbook. Please save as an Excel Workbook and try again.';
$this->log->error('Error loading file: '.$e->getMessage() . mime_content_type($uploadFile) . $message);
return ['error'=>true,'message'=>$message];
}

我不明白为什么它会增加 1/2 秒的时间。这是正常行为还是我需要更新 Redis 中的任何内容?

最佳答案

也许可以用redis连接池,需要的时候不要用redis,可以提前准备。

关于redis - 带有 redis 的 phpspreadsheet 增加了运行时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56058503/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com