mongoid-cached-json icon indicating copy to clipboard operation
mongoid-cached-json copied to clipboard

Support cache: false for individual fields

Open dblock opened this issue 13 years ago • 2 comments

Add an option not to cache specific relationships.

dblock avatar Jan 23 '13 14:01 dblock

Good call! This would help rectify stale cache issues with existing API endpoints that reference resources across collections.

fancyremarker avatar Jan 23 '13 15:01 fancyremarker

The case for doing this on a per-field basis is interesting but not one I'd thought of. My use case involves a model that changes frequently enough and is sensitive enough that I want to avoid caching its JSON representation at all. But, it would be nice if I could still declare the as_json schema (including different sets of properties, etc.) with a json_fields declaration in the same way as in my Mongoid::CachedJson models.

To summarize: this gem currently provides 2 things: a nice syntax for declaring a model's JSON schema, and caching of those results. Maybe it's worth considering how to offer those separately?

joeyAghion avatar Jan 23 '13 16:01 joeyAghion