mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
Update README.md
add other params description
This commit is contained in:
committed by
GitHub
parent
cdae610432
commit
ba7276ba98
10
README.md
10
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.
|
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.
|
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.
|
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
|
### Custom coder
|
||||||
|
|
||||||
By default use `JsonCoder`, you can write custom coder to encode and decode cache result, just need inherit `fastapi_cache.coder.Coder`.
|
By default use `JsonCoder`, you can write custom coder to encode and decode cache result, just need inherit `fastapi_cache.coder.Coder`.
|
||||||
|
|||||||
Reference in New Issue
Block a user