{"repo":"a-luna/fastapi-redis-cache","free":true,"listed":false,"github":"https://github.com/a-luna/fastapi-redis-cache","clone":"git clone https://github.com/a-luna/fastapi-redis-cache.git","description":"A simple and robust caching solution for FastAPI that interprets request header values and creates proper response header values (powered by Redis)","language":"Python","stars":155,"topics":["fastapi","api-cache","web-cache","redis-py","redis-database","fastapi-extension","redis-cache","redis","python3","python37"],"license":"MIT","category":"databases-storage","readme_excerpt":"fastapi-redis-cache - Features - Installation - Usage - Initialize Redis - @cache Decorator - Response Headers - Pre-defined Lifetimes - Cache Keys - Cache Keys Pt 2. - Questions/Contributions Features - Cache response data for async and non-async path operation functions. - Lifetime of cached data is configured separately for each API endpoint. - Requests with Cache-Control header containing no-cache or no-store are handled correctly (all caching behavior is disabled). - Requests with If-None-Match header will receive a response with status 304 NOT MODIFIED if ETag for requested resource matches header value. Installation pip install fastapi-redis-cache Usage Initialize Redis Create a FastApiRedisCache instance when your application starts by defining an event handler for the \"startup\" event as shown below: After creating the instance, you must call the init method. The only required argument for this method is the URL for the Redis database ( host url ). All other arguments are optional: - host url ( str ) &mdash; Redis database URL. ( Required ) - prefix ( str ) &mdash; Prefix to add to every cache key stored in the Redis database. ( Optional , defaults to None ) - response header ( str ) &mdash; Name of the custom header field used to identify cache hits/misses. ( Optional , defaults to X-FastAPI-Cache ) - ignore arg types ( List[Type[object]] ) &mdash; Cache keys are created (in part) by combining the name and value of each argument used to invoke a path operation functi","default_branch":null,"files":null,"tree":[],"storefront":"/r/a-luna","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/a-luna/fastapi-redis-cache/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}