Skip to content

Instantly share code, notes, and snippets.

@tinco
Created February 24, 2010 14:08
Show Gist options
  • Save tinco/313444 to your computer and use it in GitHub Desktop.
Save tinco/313444 to your computer and use it in GitHub Desktop.
Caching on DM is a bit weird because of the lazy loading.
Modelname.all would return a query object instead of a result set. The result set would only be generated when an attribute would actually be accessed.
Modelname.caches.all using the existing cache_fu would just return a cached query, not the results.
Proposal: Have caches be proxy for Modelname, that overrides the actual load/write by the cached methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment