Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 539 Bytes

File metadata and controls

28 lines (19 loc) · 539 Bytes

Example 04 — Namespaces

<?php
require_once __DIR__ . "/../vendor/autoload.php";

use Silviooosilva\\CacheerPhp\\Cacheer;

$options = [
    "cacheDir" =>  __DIR__ . "/cache",
];

$Cacheer = new Cacheer($options);

$namespace = 'session_data_01';
$cacheKey = 'session_456';
$sessionData = [
    'user_id' => 456,
    'login_time' => time(),
];

Cacheer::putCache($cacheKey, $sessionData, $namespace);
$Cacheer->putCache($cacheKey, $sessionData, $namespace);

$cachedSessionData = $Cacheer->getCache($cacheKey, $namespace);