-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.4] Laravel cache does not support false as a cached value anymore #17188
Comments
Predis returns |
To get around this, we could get each connector to throw an exception for a miss? |
@tillkruss public function get($key)
{
$value = $this->connection()->get($this->prefix.$key);
if (! is_null($value) && $value !== false) {
return $this->unserialize($value);
}
} |
Indeed, HHVM support has been dropped. |
It's probably indeed true we need a PR to normalize this across the drivers so that null is returned for miss from both. |
I don't think storing PHP types like booleans in Redis is a good idea in general.
For both, Predis and PhpRedis. However the root problem seems to be that |
@tillkruss true is not stored as 1 and false is not stored as empty string
in the current code. true and false (as well as everything except numbers)
are php-serialized into strings before being stored.
|
Right, when using Laravel's cache, not when using Redis directly. |
See #17196 (comment) |
That's it. I am done with Laravel. What is this for a reason? Cache::has() should only check if the key exists and nothing more. Why even check the inner results? |
@casperbakker: Feel free to open a discussion on https://github.com/laravel/internals about this. |
Description:
I think #15160 has an unnecessary change that should be undone, unless there is a reason for that:
In the code, all the checks for
if (is_null($value))
are converted toif (is_null($value) || $value === false)
. IMHO, it adds an unnecessary limitation to the Laravel Cache.@tillkruss do you agree?
Steps To Reproduce:
Expected output:
true
Actual output:
false
The text was updated successfully, but these errors were encountered: