fastapi-cache
fastapi-cache copied to clipboard
add backend:Diskcache
diskcache: github
I think diskcache
is a good library to use in the absence of an installable backend.
diskcache
is a library that uses local drive and sqlite
, and is not much different from redis
, the results of its own benchmark of diskcache
.
I expect it to work normally, but I haven't checked it properly yet. In particular, namespace
in the clear
method is not a feature supported by diskcache
, so it is written somewhat inefficiently. I don't know if using tag
can solve it in a similar way.
In addition, diskcache
does not support asynchronous operations. Threads can be used to simulate asynchronous tasks, but they were not used because they were not good methods.
There may be a lot of deficiencies in this PR that I write for the second time. I would appreciate it if you could consider that.