Closed cj closed 11 years ago
Just tried it out in rails 3.1 .... works great!!! Thank you for this gem :)
It looks like the way you are doing it the records are stored indefinitely.... do you have an expire method that can be placed in the model? like expire 1.hour.from_now
? If not I'll look into adding it.
One other question, how hard would it be to update the gem to behave like ActiveRecord 3? (I might have a look into doing it as I think it would be worth it)
Hello, cj. Thanks for your feedback)
Yes, it works great with rails 3.1 as far as I know it. As to the 'expire' method... hm. Could you please describe the example where it might be used?
Actually I was thinking about adding named scopes right now. And yes, I'm considering rewriting this gem so it'll have ActiveRecord3 API. I'll start the next iteration in the next year)
+1 for the expiry
This is my use case: I have an expensive operation in one of my models, so instead of doing that operation again and again I could cache the result as a 'record' using this gem. The next time I have to do this, I would check if the record is there and use it if it is. However the cached result is not meant to last forever, it should expiry after some time.
@sporto, yes, I think I could add expire class method so in classes a developer could write something like this:
expire 1.hour.from_now, :if => Proc.new{|record| record.predicate?}
@sporto I've added expire method the the classes (you could check an updated README). It's basic implementation but I think it should be sufficient for now. Thanks for your feedback.
Great, that was so quick. I will have a go at this. Thanks.
@sporto yeah but all new changes are in the master branch now. I'll add more features with Redis expire command (like setting expire period inline while saving a record), more tests and then push new gem to gemcutter.
Hi,
Your redis gem looks really interesting.... few questions... does it support rails 3.1 and how long do the records live? Are you using http://redis.io/commands/expire at all?
Many thanks