Open prpetten opened 3 years ago
That's a good thought, but this could also be implemented as a simple method like this right?
def prime_cache
ToucanSam.new(self).as_json
end
That being said, it also seems like it would be just as easy to add to the gem. If there is enough demand for it, I'd be happy to add it in or accept a PR.
I was thinking on adding this as well. @prpetten Did you get to implement this? If not, I can take care of it.
This way you would be invalidating your cache and creating a new one on every CRUD action so that you'd nearly always be getting a cached result from the serializer.
In concert with this functionality, it would be nice to have a rake task to prime all of the caches initially.