NAME

PAGI::Middleware::Session::Store - Base class for async session storage

SYNOPSIS

package My::Store;
use parent 'PAGI::Middleware::Session::Store';
use Future;

sub get {
    my ($self, $id) = @_;
    # Return Future resolving to hashref or undef
}

sub set {
    my ($self, $id, $data) = @_;
    # Return Future resolving to the transport value
}

sub delete {
    my ($self, $id) = @_;
    # Return Future resolving to 1
}

DESCRIPTION

PAGI::Middleware::Session::Store defines the async interface for session storage backends. All methods return Future objects so that storage operations can be asynchronous (e.g. Redis, database).

Subclasses must implement get, set, and delete.

METHODS

new

my $store = PAGI::Middleware::Session::Store->new(%options);

Create a new store instance.

get

my $future = $store->get($id);

Retrieve session data for the given ID. Returns a Future that resolves to a hashref of session data, or undef if no session exists for that ID. Subclasses must implement this.

set

my $future = $store->set($id, $data);

Store session data for the given ID. Returns a Future that resolves to the transport value — the opaque token the session middleware hands to the State handler to send to the client. For server-side stores this is the session ID (unchanged from the $id argument); for cookie stores it is the encoded session blob. Subclasses must implement this.

delete

my $future = $store->delete($id);

Remove session data for the given ID. Returns a Future that resolves to 1 on success. Subclasses must implement this.

SEE ALSO

PAGI::Middleware::Session::Store::Memory - In-memory session store

PAGI::Middleware::Session - Session management middleware