From cdae61043204bb23aa9e7edd3348309145d49aac Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetcov Date: Sun, 10 Jan 2021 16:26:41 +0100 Subject: [PATCH 1/2] Update README.md add explanation about expire --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 01482f1..d4c5477 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,8 @@ And if you want use `ETag` and `Cache-Control` features, you must pass `response You can also use `cache` as decorator like other cache tools to cache common function result. +`expire` parameter states a caching time in seconds. + ### Custom coder By default use `JsonCoder`, you can write custom coder to encode and decode cache result, just need inherit `fastapi_cache.coder.Coder`. From ba7276ba98cee89e82cf1a9fbbb92eab28b03718 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetcov Date: Mon, 11 Jan 2021 17:37:39 +0100 Subject: [PATCH 2/2] Update README.md add other params description --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4c5477..3f83aed 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,18 @@ Firstly you must call `FastAPICache.init` on startup event of `fastapi`, there a If you want cache `fastapi` response transparently, you can use `cache` as decorator between router decorator and view function and must pass `request` as param of view function. +Parameter | type, description +------------ | ------------- +expire | int, states a caching time in seconds +namespace | str, namespace to use to store certain cache items +coder | which coder to use, e.g. JsonCoder +key_builder | which key builder to use, default to builtin + + And if you want use `ETag` and `Cache-Control` features, you must pass `response` param also. You can also use `cache` as decorator like other cache tools to cache common function result. -`expire` parameter states a caching time in seconds. - ### Custom coder By default use `JsonCoder`, you can write custom coder to encode and decode cache result, just need inherit `fastapi_cache.coder.Coder`.