djangosnippets.org: Latest snippets tagged with 'local memory'https://djangosnippets.org/tags/local-memory/2012-09-24T04:58:24.691794-05:00Function decorator for caching function results in local memory
2012-09-24T04:58:24.691794-05:00bikeshedderhttps://djangosnippets.org/snippets/2824/<pre><code>@cache(60)
def heavy_computation():
for x in xrange(10000000):
pass # just waste some time`
</code></pre>
<p>The result of <code>heavy_computation</code> calls will be cached for 60 seconds. This cache decorator does not use the Django cache backend and uses the local memory instead.</p>
Freely redistributable