niryariv/opentaba-server — pull request #56 by shevron (2014-01-04 16:18:15+00:00)
Title: Basic API Caching Support

This is a first poke at server-side caching for the API. I would like your comments on it before moving on with it (will also need to add some tests).

The caching API is based on werkzeug caching, which provides a transparent API for memory, file-system, memcache and redis based caching. For now I've used Filesystem, but we can easily switch to redis or better yet memcache.

The implementation is a decorator so its very easy to cache the result of an API call. In addition to caching on the server side, we also employ client-side caching by adding an "Expires" header by default. This is a bit risky but its very high performance (browsers do not revalidate "Expires" responses at all until they expire or their cache is cleared, so no "If-modified-since" -> "Not Modified" validation requests).

@alonisser @florpor @niryariv if you guys give this approach thumbs up, I will clean it up a bit and add some tests, then we can merge.