-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix locking #18
Fix locking #18
Conversation
This looks promising, I think |
@kinglozzer you are right thought i might have some reason to skip it when I created the locking.. Can't frankly remember it anymore :) . That might need a while loop against the existence of the lock so it could lock it to it self as soon as possible. |
This looks like it might help a little, but as your locking isn't atomic it's not going to completely solve the issue - it just narrows the window where a race condition can occur, roughly by the duration of an I'm all for small improvements, but I'm hesitant to accept this with the extra clean up that will be needed for backends that don't support a TTL, given that it doesn't completely fix the problem here. With the current way CacheInclude works, a couple of other options might be:
|
I'd just wish that the cache drivers would support getting keys with wildcards. That would help also. Limiting to only few supported cache types would of course ease on the pain on maintaining that support lists or wildcards. After featuring this additional tweak: Sohova/silverstripe-cacheinclude@c878669 we have being using this against redis servers without any major issues. |
Just to keep this rumbling along: I’ve been running a variation of this PR (using |
@kinglozzer much simpler than ours.. Can't remember why i wanted to force the lock file to the cache also. |
@kinglozzer I did add this also to prevent races if flushling caches from the manager https://github.com/heyday/silverstripe-cacheinclude-manager/pull/2/files or it seemed that I needed to. |
Ah, I’m not running the cache manager module so haven’t made any changes to that |
First steps on trying fixing the issue #17
Also there will be a pull request to the cache manager side also as that needs to use locking as well.
Seems to work with the redis provider but there is sue with lock carbage collection if the provider doesn't support setting TTL's for the keys.
Will tweak this more next week and squash the commits to a single one.
The cc for the lock keys isn't high priority for us as we use redis 100% so not sure will I be able to source time to tweak that.