Closed dengshaochun closed 6 years ago
when function only with kwargs As shown below.
$ cat test.py from flask import Flask from flask_cache import Cache app = Flask(__name__) cache = Cache(config={'CACHE_TYPE': 'simple'}) cache.init_app(app) @cache.memoize(timeout=120) def foo(**kwargs): return str(kwargs) @app.route('/') def index(): st = foo(a=1, b=2) st2 = foo(a=3, b=4) print 'st:%s , st2:%s ' % (st, st2) return '<html><h1>st:%s, st2:%s</h1></html>' % (st, st2) if __name__ == '__main__': app.run(host='192.168.249.169', port=5000) # run this demo $ python test.py runserver * Running on http://192.168.249.169:5000/ (Press CTRL+C to quit) st:{'a': 1, 'b': 2} , st2:{'a': 1, 'b': 2} 172.16.84.9 - - [30/Nov/2017 20:58:59] "GET / HTTP/1.1" 200 -
The result is not what we want. when i modify the code, The running results are shown below
$ python test.py runserver * Running on http://192.168.249.169:5000/ (Press CTRL+C to quit) st:{'a': 1, 'b': 2} , st2:{'a': 3, 'b': 4}
when function only with kwargs As shown below.
The result is not what we want. when i modify the code, The running results are shown below