sunlightlabs / read_FEC

Turn raw electronic FEC filings into meaningful data
http://realtime.influenceexplorer.com
BSD 3-Clause "New" or "Revised" License
19 stars 7 forks source link

investigate drf caching #58

Closed jsfenfen closed 11 years ago

jsfenfen commented 11 years ago

can we cache only certain views while using viewset?

jsfenfen commented 11 years ago

This is sorta annoying using viewsets. Probably not a great way to do this, but one can hardcode a cache time for everything touched by drf by changing routers.py

            ret.append(url(regex, view, name=name))

to

            ret.append(url(regex, cache_page(60)(view), name=name))

(and importing the right lib). If we've got api keys, though, this is gonna cache per-api-key though, so this probably isn't quite sufficient.

jsfenfen commented 11 years ago

Closing for now--may need to revisit / revise w/ api keys.