NAME

Concierge::Sessions::SQLite - SQLite backend for session storage

VERSION

version 0.8.5

SYNOPSIS

# Used internally by Concierge::Sessions
my $sessions = Concierge::Sessions->new(
    backend     => 'database',
    storage_dir => '/var/app/sessions',
);

DESCRIPTION

Concierge::Sessions::SQLite provides SQLite-based storage for session data. It is the default and recommended backend for production use, offering high performance and ACID-compliant storage.

This backend inherits from Concierge::Sessions::Base and implements all required backend methods. Users typically do not interact with this class directly - they use Concierge::Sessions which manages the backend.

FEATURES

  • High performance (4,000-5,000 operations per second)

  • ACID-compliant transactions

  • Automatic filtering of expired sessions during retrieval

  • Single-session enforcement at database level (using UNIQUE constraint)

  • Efficient indexing on session_id and user_id

STORAGE

The backend creates a SQLite database file named sessions.db in the specified storage_dir. The database contains a single table sessions with columns for session data and metadata.

Database schema:

CREATE TABLE sessions (
    session_id TEXT PRIMARY KEY,
    user_id TEXT,
    created_at TIMESTAMP,
    expires_at TIMESTAMP,
    last_updated TIMESTAMP,
    session_timeout INTEGER,
    status JSON,
    data JSON
)

Indexes are created on session_id and user_id for fast lookups.

PERFORMANCE

The SQLite backend provides high performance suitable for production use:

  • Create session: ~0.0002 seconds

  • Get session: ~0.0002 seconds

  • Update session: ~0.0002 seconds

  • Delete session: ~0.0002 seconds

Benchmarks performed on typical hardware with default SQLite settings.

SEE ALSO

Concierge::Sessions - Session manager

Concierge::Sessions::Base - Backend base class

Concierge::Sessions::File - File backend implementation

DBI - Database interface

DBD::SQLite - SQLite DBI driver

AUTHOR

Bruce Van Allen <bva@cruzio.com>

LICENSE

Artistic License 2.0