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_duration not used in set #8

Open
rdfield opened this issue May 2, 2019 · 0 comments
Open

session_duration not used in set #8

rdfield opened this issue May 2, 2019 · 0 comments

Comments

@rdfield
Copy link

rdfield commented May 2, 2019

When using the setting session_duration in the environment file it isn't being passed through to the Cache::Memcached->set when the flush method is called.

Example environment settings:

engines:
session:
Memcached:
cookie_name: dancer2_cookie
is_http_only: 1
is_secure: 1
session_duration: 3600
memcached_servers:
- 127.0.0.1:11211

When SessionFactory calls _flush in Dancer2::Session::Memcached it only supplies the key and value. When the Dancer2:Session::Memcached object is created $self->session_duration is set correctly, but it isn't used.

Adding an extra line that appends the exptime parameter to the $self->memcached->set(@) call makes sure the session expires at the right time, e.g.

sub _flush {
    my ($self) = shift;

    croak "Memcache cluster unreachable _flush"
        if $self->fatal_cluster_unreachable && not keys %{$self->_memcached->stats(['misc'])};

    # append session_duration if set
    push @_, $self->session_duration if $self->session_duration and $#_ < 2; 

    return $self->_memcached->set( @_ );
}
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