Elver Loho wrote: > Can Django's caching framework somehow be used to cache the output of > any function? > [...] > > Does Django offer any decorators for caching the output of any > function, such as get_latest_books, based on the arguments passed to > it? > [...]
Such decorators already exist. See: http://wiki.python.org/moin/PythonDecoratorLibrary (memoize decorator) http://www.phyast.pitt.edu/~micheles/python/documentation.html#memoize Did you try them? For caching database query results, did you try to setup something like memcached? This might offer more reliable caching when there are updates to your database-tables. And any caching should take into account that there can be concurrent updates from multiple threads, multiple applications, possibly running on multiple machines... I do suspect that if such decorators would be added to Django, that for DB specific caches they would work only with Django's own ORM, and that for anything else the existing decorators above are 'good enough'. > > > Elver Cheers, --Tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---