PHP 操作 Redis 时遇到如下的问题
Deprecated: Function Redis::delete() is deprecated
原因:php-redis 5 版别弃用了 Redis::delete()
php -r 'phpinfo();'
运转上述指令在输出中找到 redis,看到为 5.0.1 版别
解决方法:将 delete($key) 改成 del($key) 的操作即可
参考:
https://www.drupal.org/project/redis/issues/3068810 this is caused by the update to php-redis 5, apparently only in the PHP 7.3 images.
https://github.com/phpredis/phpredis/pull/1588 all aliases are deprecated & delete is an alias for del
https://pecl.php.net/package-changelog.php?package=redis&release=5.0.0 Soft deprecate methods that aren't actually Redis commands [a81b4f2d, 95c8aab9]
https://github.com/phpredis/phpredis/pull/1572