在 Codeigniter 中,我使用 Composer 安装了 predis 包。我可以使用这个包设置和获取缓存中的值。我的要求是我需要使用 Redis
将值保存在缓存中 1 分钟。我通过 Redis
终端看到了不同的选项设置。但是我需要在 Controller 本身中设置时间限制。任何想法 ?
最佳答案
只需通过predis使用EXPIRE
即可:
$client = new Predis\Client();
$client->set('foo', 'bar');
$client->expire('foo', 60);
关于php - 使用 predis 包将缓存超时设置为 Codeigniter 中的一个键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35269433/