vibe.caching

Request-scoped caching utilities for Flask applications.

request_cached

request_cached(func: Callable[P, R]) -> Callable[P, R]

Cache function result for the duration of the Flask request.

Uses Flask's g object for storage, which is automatically cleared after each request. The cache key is based on: - Function module and qualified name - Hash of positional args (or id for unhashable/instance args) - Hash of keyword arguments

Usage

@request_cached def expensive_computation(self, data): ...

Note: This decorator requires an active Flask application context. For functions called outside a request context, the function will execute without caching.