Comments (1)
No, it expects an HTTP request and checks the method type in order to determine if the result should be cached. For regular functions, you can use the decorators from the built-in functools
module:
@lru_cache
- available since 3.2
@cache
- available since 3.9
@cached_property
- available since 3.8
However, all of these will only cache results while your program is running. If you are asking because you need to cache results and persist them, the package below looks like it could be what you need:
from fastapi-redis-cache.
Related Issues (20)
- eTag generation should be optional and configured via a global setting AND a setting per-endpoint
- cache-control: no-cache behavior is wrong HOT 1
- user can add must-revalidate directive to responses
- add support for if-modified-since directive
- ttl expired -> request contains eTag/last-mod -> current behavior is wrong
- feature: provide method on `FastApiRedisCache` object that allows user to delete single cache items by key HOT 1
- Object of type <class '...'> is not JSON-serializable HOT 3
- Nothing being cached HOT 2
- coroutine '<method that is cached>' was never awaited HOT 1
- Use cache() decorator outside of fastapi HOT 3
- handling dirty cache entries HOT 1
- How can I cache POST requests? HOT 4
- [Question] How to manually expire an entry ? HOT 1
- Add support for authentication to a remote redis HOT 2
- Feature request - async Redis client
- "Too much data for declared Content-Length" error when activating caching HOT 5
- Can't Cache List of serialized data HOT 1
- add async support for redis HOT 1
- @cache Decorator Not Working
- A Rebuild Maybe ?! ....
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastapi-redis-cache.