bungle / lua-resty-session

Session library for OpenResty – flexible and secure
BSD 2-Clause "Simplified" License
320 stars 111 forks source link

redis TTL not updated / prefix not set #81

Closed ghost closed 4 years ago

ghost commented 4 years ago

Using redis as storage backend, session was initialized using:

           local session = require "resty.session".open{
                 name = "cookie_name",
                 storage = "redis",
                 cookie = {
                    session_cookie_lifetime =  1800,
                 },
                 redis = {
                    session_redis_prefix = 'customprefix',
                 },
            }

The prefix customprefix isn't set and the TTL of a session key inside redis is still set to 1 hour (requested a few seconds, after session was started):

127.0.0.1:6379> TTL sessions:gYIipoo9Ydrk-qXbsvFKPQ.. (integer) 3574

Will I need to create the session in another way?

ghost commented 4 years ago

Solved by using:


local session = require "resty.session".start{
                 name = "name",
                 storage = "redis",
                 redis = {
                    prefix = 'redispref',
                 },
                 cookie = {
                    lifetime = 1800,
                    renew = 1800,
                 },
            }```