-
Notifications
You must be signed in to change notification settings - Fork 68
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
lada-cache:flush generates Redis-Cluster error - cannot use "KEYS" #62
Comments
Didn't test the flush command so far with a cluster, to be honest. Predis does currently not support several commands for cluster environments, will need to develop a workaround for this. Are you actually using a cluster? |
yeah using a cluster in production on AWS Elasticache. A workaround is to change the config locally to default when running a migration, but that just introduces problems because I can't be sure if it will work the same way in production I guess. |
Well, what you always can do is flushing the entire Redis DB on production instead of just Lada Cache. That will certainly work if your application doesn't depend on any data in Redis being persistent. |
Ok true, or I switch to cluster mode disabled. Luckily I am flexible there. |
This is the fix suggested by someone in the Laravel repo for using flush with cache tags, it might also solve this issue here as I saw Lada cache also isn't using curly braces: |
I am not sure if that's going to work, according to the author of Predis one would need to iterate over all connections: predis/predis#338 (comment) It appears a bit strange to me why this should be required since for all other commands iterating is not required, but ok, either this or your proposed solution should work for sure. |
Can't say anything about the connection looping, I tested the curly brace solution with Laravel 5.6 and there it seemed to fix the issue indeed, after implementation the errors about 'Cannot use 'DEL' with redis-cluster.' in combination with Cache::tags() were gone. |
@spiritix What's the state of this issue currently? |
@xwiz I currently only have capacity to fix major bugs in my open source projects. Contributions are very welcome. |
Thanks @spiritix Looks like that will happens as I'm running into some issues. Good to know you're open to contributions. |
I think for contributors it would be great to have documented the current conditions that trigger the flush cache automatically. By default I assume that would be created, updated, and deleted but one needs to delve into the code to confirm. |
So the flush command is never triggered automatically. It's only for debug and maintenance purposes, that's why I am not scheduling this with high priority at the moment. The invalidation of the cached items is not related to flushing the cache, you may have a look at the Wiki to see how this works (https://github.com/spiritix/lada-cache/wiki). |
Laravel: v5.6.16
Trying to run lada-cache:flush before a new migration (and also trying to run the db:seed command)
generates a redis error:
This is my database.php config:
The text was updated successfully, but these errors were encountered: