Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cache() decorator outside of fastapi #61

Open
cmabastar opened this issue Sep 24, 2021 · 3 comments
Open

Use cache() decorator outside of fastapi #61

cmabastar opened this issue Sep 24, 2021 · 3 comments

Comments

@cmabastar
Copy link

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.

@kishvanchee
Copy link

@cmabastar here are two links which don't use this package but set cache using the background task feature of fastapi.

  1. https://developer.redis.com/develop/python/fastapi/
  2. https://github.com/redis-developer/fastapi-redis-tutorial/blob/master/app/main.py

@bkanuka
Copy link

bkanuka commented Jun 2, 2022

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

@bkanuka
Copy link

bkanuka commented Jun 2, 2022

I've opened a pull request for this: #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants