Caching

posted 2014-11-13 by Herb

An experimental caching module has been added. This module makes it really simple to add caching to any method or function that returns a string (i.e. page content) using decorators.

example:

    >>> class foo(object):
    ...
    ...     def __init__(self, value):
    ...         self.value = value
    ...
    ...     @cached(key)
    ...     def get_value(self, param=''):
    ...         return self.value + param
    ...
    >>> a = foo('bar')
    >>> a.get_value()
    'bar'
    >>> a.value = 'bahr'
    >>> a.get_value()
    'bar'

This is still experimental so the API may change. Feedback welcome.