flask-caching icon indicating copy to clipboard operation
flask-caching copied to clipboard

flask-caching cannot use as a decorator for async function

Open datacore-andyzhu opened this issue 4 years ago • 10 comments

The following works:

@jira_api.route('/bugs/sync') @mycache.cached(timeout=50, key_prefix='sync') def show_bug_sync(): return {'message': 1}

The following does not work: @jira_api.route('/bugs/sync') @mycache.cached(timeout=50, key_prefix='sync') async def show_bug_sync(): return {'message': 1}

And get the error: ( I omit the actual path to the flask-caching package in my virtual env)

File ".....\flask_caching_init_.py", line 479, in decorated_function self.cache.set( File ".....\flask_caching\backends\simplecache.py", line 101, in set item = (expires, pickle.dumps(value, pickle.HIGHEST_PROTOCOL))Open an interactive python shell in this frame TypeError: cannot pickle 'coroutine' object

datacore-andyzhu avatar Jul 18 '21 05:07 datacore-andyzhu

#282

ponytailer avatar Oct 12 '21 14:10 ponytailer

@northernSage this fix has been merged. Any idea when this can be released to pypi?

benney-au-le avatar May 10 '22 23:05 benney-au-le

@benney-au-le Currently trying to get in touch with previous maintainer since I don't have pypi credentials. @sh4nks, are you there? 😢

northernSage avatar May 19 '22 10:05 northernSage

@northernSage I am still around :-)

Not sure if I have time this evening but I am sure I can transfer them to you or to the org in the next couple of days! If I forget please ping me again

sh4nks avatar May 19 '22 11:05 sh4nks

@sh4nks Awesome, whatever is easier for you. My usernames:

  • pipy: gfvante
  • readthedocs: northernSage

northernSage avatar May 19 '22 12:05 northernSage

@sh4nks pinging you again as per request. Also, I really want to make our next release :bowtie:

northernSage avatar May 24 '22 20:05 northernSage

@northernSage Added you to the PyPI project and to the readthedocs project! :-)

sh4nks avatar May 25 '22 07:05 sh4nks

@sh4nks awesome, thanks!

northernSage avatar May 27 '22 18:05 northernSage