djangosnippets.org: Latest snippets tagged with 'threading'https://djangosnippets.org/tags/threading/2009-06-29T07:52:52.978799-05:00RequestMiddleware
2009-06-29T07:52:52.978799-05:00martynchttps://djangosnippets.org/snippets/1605/<p>Add RequestMiddleware to your MIDDLEWARE_CLASSES settings
Then, when you need request in special cases, call get_request(), which returns the request object.
This has to be used in very special cases.</p>
Freely redistributableCache any function (with its arguments)
2007-04-25T16:31:18.809648-05:00bkroezehttps://djangosnippets.org/snippets/202/<p>Please see original snippet for commentary, all I did was add the caching of the arguments.</p>
<p>http://www.djangosnippets.org/snippets/109/</p>
Freely redistributableCache Any Function
2007-03-14T23:52:29.556905-05:00jeffwheelerhttps://djangosnippets.org/snippets/109/<p>A decorator similar to <code>cache_page</code>, which will cache any function for any amount of time using the Django cache API.</p>
<p>I use this to cache API calls to remote services like Flickr in my view, to prevent having to hit their servers on every request.</p>
<p>I posted a sample …</p>
Freely redistributable