Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session save have no effect after output ? #152

Open
Flash-ang opened this issue Dec 4, 2022 · 0 comments
Open

Session save have no effect after output ? #152

Flash-ang opened this issue Dec 4, 2022 · 0 comments

Comments

@Flash-ang
Copy link

Flash-ang commented Dec 4, 2022

Test Code :

local session = require "resty.session".start{ cookie = { domain = "localhost" }, secret = "623q4hR325t36VsCD3g567922IC0073T" }

function list()
    ngx.say( 'list session.data : ' );
    for k, v in pairs(session.data) do
        ngx.say( 'session.data : ', k, ' = ', tostring(v) )
    end
    ngx.say();
end


if( session.data.uid == nil ) then
    session.data.uid = 0;
else
    session.data.uid = session.data.uid + 1
end

session:save()

list()

session.data.uid = session.data.uid + 100000
session.data.name = "f3() + " .. tostring(session.data.name )
session:save()

list()
Output (#1 round clear cache) : 
list session.data : 
session.data : uid = 0

list session.data : 
session.data : name = f3() + nil
session.data : uid = 100000

Output (#2 round press refresh) : 
list session.data : 
session.data : uid = 1

list session.data : 
session.data : uid = 100001
session.data : name = f3() + nil

Output (#3 round press refresh) : 
list session.data : 
session.data : uid = 2

list session.data : 
session.data : uid = 100002
session.data : name = f3() + nil

if this is the design, may state in documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant