-
Notifications
You must be signed in to change notification settings - Fork 173
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
Redis backend with CAS integration #351
Comments
That's great! I think it would make sense to update the README to link to different backends and stop making it sounds like the gem only works with identity cache. Sorry about the lack of documentation on the methods that the backend requires. I don't even see documentation in the memcached_store gem for it. Basically the
Ideally I would like to push those methods upstream to ActiveSupport::Cache::MemCacheStore so we don't depend on non-standard extensions to the rails cache store API. In the meantime, documentation for these methods would certainly be welcome. Is redis-store meant to be used as a rails compatible cache store? If so, then I don't see why there would be a need for redis-activesupport-with-cas, since redis-store-with-cas should provide the desired interface for using with IdentityCache directly. Otherwise, it seems like redis-activesupport-with-cas would be providing a weird hybrid where If we want to test it as part of the identity cache backend, then we would probably want a way to swap out the memcached_store backend with other stores in a similar way to how we allow the test suite to be run with mysql or pg as a database. |
TL;DR: Well, redis-store is more an enhancement of low-level redis client for ruby independend of rails. I wrote
In my project we use the CAS-workflow on a very raw level AND for activesupport eg rails. Thats the next reason why both. so: redis-store is meant as extension to ruby itself, redis-activesupport is the riddle between rails-activesupport and redis-store. Same for the Yes, its a little bit confusing for the first time, but after a while it makes sense splitting all parts into separate gems. |
forgot: The whole redis projects with all assigned gems |
bump, any updates for rails 6? |
@danielnc what do you mean for Rails 6? This gem already support Rails 6. |
@rafaelfranca question was related to a redis cache store + rails 6 |
Ah, the Redis cache store on Rails 6 doesn't support CAS, so it can't work with this gem. So far the only supported store is the memcache store. |
@rafaelfranca thanks, if there are any plans to support redis, let us know best, |
@rafaelfranca Any updates on redis cache store and this gem for Rails 7? |
The more direct equivalent to CAS support in redis is the WATCH command (which is what redis-store-with-cas uses), except that isn't ideal for fetch_multi support, since it would cause an entire batch to be invalidated by a conflict in a single key. Instead, it probably makes sense to version the cache invalidation value (will be needed for #535 anyways) and to use a set_if_equal lua script to set the value if it is still equal to the given value. That will be functionally equivalent and would allow it to be efficiently pipelined. The single key transactions should even work with a distributed redis servers, since each transaction would only affect a single key. We could have an extension for ActiveSupport::Cache::RedisCacheStore in a similar way as we do with IdentityCache::MemCacheStoreCAS extending ActiveSupport::Cache::MemCacheStore. Although, in this case it looks like there is a public It will also make sense to take advantage of redis pipelining / multi commands for batching writes, such as cache invalidations, which is even something that the standard cache interface supports with |
Hi
I wrote for a project using your cache a backend using Redis: https://github.com/Messinger/redis-activesupport-with-cas (based on redis-store)
I read somewhere that you want informed when someone did it.
My questions:
Hope someone will find this gem usefull, too.
The text was updated successfully, but these errors were encountered: