unepwcmc/SAPI — pull request #79 by agnessa (2013-09-23 08:52:43+00:00)
Title: Caching

This PR is targeted at fixing the issues with caching taxon concept search & show page by replacing the existing caching mechanism.

Two problems that were identified with caching were:
-> when adding a new quota it would not show immediately on taxon concept page (that applies also to other information that should be immediately available, e.g. CITES suspensions)
-> when adding a new listing change the cache would not get refreshed properly after the overnight tests finished; that affected both legislation showing on taxon concept page as well as casched searches in the Checklist

The solution was to remove entirely action caching from Api::V1::TaxonConceptsController and Checklist::TaxonConceptsController (and remove the sweeper).
-> The index and autocomplete actions in both controllers are now cached using low level caching implemented in SearchCache module. A cache counter is stored and incremented in TaxonConcept observer. It is also incremented in the Sapi.rebuild task if any changes are found.
-> The Api::V1::TaxonConceptsController show action is cached in the serializer. To make sure cascading legislation gets refreshed, the updated_at timestamp is bumped in Sapi.rebuild if any changes are detected.