reactive-python/reactpy-django

Add a cache decorator

Closed this issue · 1 comments

Current Situation

We currently don't have any multiprocessing compatible way to cache component renders, similar to Django's cached_page decorator.

Proposed Actions

Create a caching decorator. The API might look something like this....

def cache_component(timeout, *, cache=None):
    """The cache is keyed by the component's dotted path."""
    ...
    return decorator


@cache_component(60 * 15, cache=REACTPY_CACHE)
@component
def example():
   ...

Closing this since it is not technologically possible to maintain interactivity while also catching renders.