"use strict";
/**
 * @adonisjs/session
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryDriver = void 0;
/**
 * Memory driver is meant to be used for writing tests.
 */
class MemoryDriver {
    /**
     * Read session id value from the memory
     */
    read(sessionId) {
        return MemoryDriver.sessions.get(sessionId) || null;
    }
    /**
     * Save in memory value for a given session id
     */
    write(sessionId, values) {
        if (typeof values !== 'object') {
            throw new Error('Session memory driver expects an object of values');
        }
        MemoryDriver.sessions.set(sessionId, values);
    }
    /**
     * Cleanup for a single session
     */
    destroy(sessionId) {
        MemoryDriver.sessions.delete(sessionId);
    }
    touch() { }
}
exports.MemoryDriver = MemoryDriver;
MemoryDriver.sessions = new Map();
