DALMP can store PHP sessions in a mysql/sqlite database or in a cache engine like redis or memcache.

One of the advantage of storing the session on mysql or cache engine is the ability to make your application more scalable, without hassle.

Besides the normal use of sessions, DALMP allows the creation of references attached to a session, this means that in some cases you can take advantage of the storage engine that keep the sessions for storing valued information.

The methods you can use to handle references stored on the sessions are:

Method Description
getSessionsRefs Return array of sessions containing any reference.
getSessionRef Return array of sessions containing a specific reference.
delSessionRef Delete sessions containing a specific reference.


The Files backend, does NOT support reference handling.

For example, you can store in the reference, the current user id ‘UID’ and configure your site to only accept users to loggin once avoiding with this duplicate entries/access using the same user/password.

DALMP\Sessions implements the SessionHandlerInterface class.

The current available backends are:

Backend Description
Files Use file system to store the sessions.
Memcache Use memcache DALMP\Cache.
MySQL Use MySQL database DALMP\Database.
Redis Use redis DALMP\Cache.
SQLite Use SQLite.

See Also:


In order to properly use DALMP\Sessions you need (PHP 5 >= 5.4.0).

A great amount of time has been spent creating, crafting and maintaining this software, please consider donating.

Donating helps ensure continued support, development and availability.


comments powered by Disqus