Use cache() decorator outside of fastapi
cmabastar opened this issue · comments
Hi i'm trying to use @cache() decorator using a worker like celery/dramatiq.
Is there a way to use decorator outside of fastapi?
@cache()
def long_function_query(word):
pass # do long running stuff.
@cmabastar here are two links which don't use this package but set cache using the background task feature of fastapi.
Also interested in this. There are some data tasks we need to do on startup of our FastAPI app, that can be/should be cached. So the functions are not specifically part of a FastAPI request function (want that too!). So being able to use cache outside a request function would allow us to cache those startup functions also
I've opened a pull request for this: #66