This project is archived and is in readonly mode.
Provide NoStore implementation of ActiveSupport::Cache::Store
Reported by Brian Durand | December 7th, 2010 @ 11:47 PM
This patch provides a NoStore implementation of ActiveSupport::Cache::Store suitable for use in development and test environments where the code need to use the cache interface, but actually caching data is not desired. It would be used then in the development.rb, for example, as:
config.cache_store = :no_store
Comments and changes to this ticket
-
Chris Hapgood December 8th, 2010 @ 01:31 PM
This is a nice way to ensure that arguments to cache-related functions are reasonable. LH is acting up -I can't see the patch and confirm this: does the patch log generously?
+1, conceptually.
-
Brian Durand December 8th, 2010 @ 03:26 PM
I didn't put in any logging. It just implements the required functions as no-ops so it always behaves like a cache miss.
-
Piotr Sarnacki December 10th, 2010 @ 02:38 PM
- Importance changed from to Low
+1 from me, I often use NoStore myself (but I call it NilStore ;).
-
Xavier Noria February 10th, 2011 @ 09:36 PM
- State changed from new to open
- Assigned user set to Xavier Noria
The idea sounds good.
We've discussed this a bit in Campfire and would like to suggest a couple of changes:
-
Instead of NoStore, NullStore is preferred, since it is a store, only it's a no-op.
-
It would be nice that config.cache_store = nil configures the NullStore.
And since we are revising the patch... you know a patch has to be self-contained. It has to come complete with the implementation, test coverage, and documentation coverage. I know you have provided docs in a different ticket. Would you merge the corresponding documentation into the revised patched so that we get everything in the same commit?
-
Brian Durand February 16th, 2011 @ 05:27 PM
New patch file attached which renames the class to NullStore and lets it be set as config.cache_store = nil.
The documentation ticket (https://rails.lighthouseapp.com/projects/8994/tickets/6309) is to update the Rails guides with changes to caching that were in the 3.0.0 release. I added reference to the changes added by this ticket so the documentation would be complete, but other than that they are independent of each other.
-
Xavier Noria February 17th, 2011 @ 08:16 AM
Hi Brian, thanks for the update.
Documentation is still missing though. The other patch has other stuff, but also explains the NullStore.
This is the patch that implements the NullStore. And thus is the patch where the documentation of NullStore has to be provided. As I commented before, the patch has to be self-contained. Code, tests, and docs. I'll amend with a line in the CHANGELOG (that's written by the committer), and up. Documentation does not have a separated workflow.
When two months later someone does a git show of the commit, he will find everything there.
-
Xavier Noria February 17th, 2011 @ 09:18 AM
Ah, just in case... My suggestion is that the docs in the other patch that cover NullStore be moved to this one. The rest of the docs you're contributing may have then their own patch, or you could push them directly via docrails if you prefer.
The point is that when a new feature is added, the ideal is a single self-contained patch.
-
Brian Durand February 17th, 2011 @ 04:33 PM
I've submitted the documentation patch (less the NullStore reference) directly to docrails. I'll need to wait for that commit to be promoted to master before I can add the NullStore documentation since it needs to go in the middle of a completely rewritten section of text.
-
Xavier Noria February 17th, 2011 @ 04:36 PM
Excellent, thanks very much. I'll do it myself as soon as possible, will post a followup here when done.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 6309 Rails Guide Update - ActiveSupport::Cache https://rails.lighthouseapp.com/projects/8994/tickets/612...
- 6309 Rails Guide Update - ActiveSupport::Cache New patch that changes the class name for the class added...
- 6309 Rails Guide Update - ActiveSupport::Cache This patch has been split in two. Improvements in the gui...