NAME

Mojolicious::Sessions::Store - another server-side session storage for Mojolicious

VERSION

version 0.01

SYNOPSIS

use Mojolicious::Lite;
use Mojolicious::Sessions::Store;
use Mojolicious::Sessions::Store::Backend::File;

app->sessions(
    Mojolicious::Sessions::Store->new(
        backend => Mojolicious::Sessions::Store::Backend::File->new(
            store_dir => app->home->child('data/sessions'),
        ),
        cookie_name        => 'myapp',
        default_expiration => 3600,
    )
);

get '/' => sub ($c) {
    $c->session(user_id => 42);
    $c->render(text => 'Session stored server-side');
};

app->start;

DESCRIPTION

Mojolicious::Sessions::Store replaces the default signed-cookie session storage with server-side storage. A signed cookie containing only a session ID is sent to the client; the actual session data lives in a backend (filesystem, Redis, database, etc.).

The Mojolicious::Controller session helper works exactly as before — the change is transparent to application code.

NAME

Mojolicious::Sessions::Store - Server-side session storage for Mojolicious

ATTRIBUTES

Mojolicious::Sessions::Store inherits all attributes from Mojolicious::Sessions and adds the following.

backend

my $backend = $store->backend;
$store      = $store->backend($backend);

The backend instance that provides load, save, and delete methods. Required. See Mojolicious::Sessions::Store::Backend for the interface.

INHERITED ATTRIBUTES

All attributes from Mojolicious::Sessions are supported, including:

HOW IT WORKS

On load():

On store():

BACKENDS

Custom backends must implement load, save, and delete as described in Mojolicious::Sessions::Store::Backend.

SEE ALSO

Mojolicious::Sessions, Mojolicious::Sessions::Store::Backend, Mojolicious::Sessions::Store::Backend::File

AUTHOR

Daniel Brosseau dab@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Daniel Brosseau.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.