feat(redis): add native JSON session storage for 4.1.0
Build & Publish Package / publish (push) Successful in 49s
Build & Publish Package / publish (push) Successful in 49s
- Add opt-in SESSION_REDIS_JSON storage for asyncio Redis backends. - Check JSON command support at startup and reject JSON mode on Trio. - Read legacy strings and migrate sessions on their next save. - Validate JSON objects before transactional replacement and expiry. - Preserve tagged serialization for datetime, tuple, and other types. - Cover command contracts, error handling, and session round-trips. - Document server requirements, permissions, and migration limits. - Normalize indentation and whitespace across code, tests, and examples. - Bump the package and lockfile to 4.1.0 and update the changelog. - Refresh the locked pycparser dependency to 3.12.
This commit is contained in:
+9
-14
@@ -1,35 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Hello
|
||||
~~~~~
|
||||
Hello
|
||||
~~~~~
|
||||
|
||||
Quart-Session demo.
|
||||
Quart-Session demo.
|
||||
|
||||
:copyright: (c) 2020 by Kroket Ltd.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
:copyright: (c) 2020 by Kroket Ltd.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
from quart import Quart, session
|
||||
from quart_session import Session
|
||||
|
||||
|
||||
SESSION_TYPE = 'redis'
|
||||
|
||||
|
||||
app = Quart(__name__)
|
||||
app.config.from_object(__name__)
|
||||
Session(app)
|
||||
|
||||
|
||||
@app.route('/set/')
|
||||
async def set():
|
||||
session['key'] = 'value'
|
||||
return 'ok'
|
||||
|
||||
session['key'] = 'value'
|
||||
return 'ok'
|
||||
|
||||
@app.route('/get/')
|
||||
async def get():
|
||||
return session.get('key', 'not set')
|
||||
|
||||
return session.get('key', 'not set')
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
app.run(debug=True)
|
||||
|
||||
Reference in New Issue
Block a user