【问题标题】:How to implement redis sessions expire in aiohttpaiohttp中如何实现redis会话过期
【发布时间】:2016-11-11 13:02:27
【问题描述】:

在aiohttp redis session中找不到redis session过期实现。会话保存在 redis 中,但随后我检查 ttl AIOHTTP_SESSION_c8a63762a87d4c01a64991e268c35f54 会话密钥没有 ttl。

如何实现过期以避免旧会话增长?我正在考虑设置

expire 'AIOHTTP_SESSION_'+session.identity 300

对于会话中间件中的每个请求,是方便还是我遗漏了什么?

【问题讨论】:

    标签: python session redis aiohttp


    【解决方案1】:

    您可以在 aiohttp-session 文档中看到 RedisStorage take a max_age parameter。这个用来设置redis_storage.py中关联redis key的过期时间

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-02
      • 2017-10-09
      • 1970-01-01
      • 1970-01-01
      • 2013-05-20
      • 2011-07-22
      相关资源
      最近更新 更多