Django Sessions

前端 未结 5 1436
野趣味
野趣味 2021-01-31 15:34

I\'m looking at sessions in Django, and by default they are stored in the database. What are the benefits of filesystem and cache sessions and when should I use them?

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 16:22

    As of Django 1.1 you can use the cached_db session back end.

    This stores the session in the cache (only use with memcached), and writes it back to the DB. If it has fallen out of the cache, it will be read from the DB.

    Although this is slower than just using memcached for storing the session, it adds persistence to the session.

    For more information, see: Django Docs: Using Cached Sessions

提交回复
热议问题