<?php
namespace Helpers\Outil;

use Psr\SimpleCache\CacheInterface;

class LightCache implements CacheInterface
{
    /** @var array<mixed> */
    private array $cache = [];

    public function __construct()
    {
    }

    public function get($key, $default = null)
    {
        return $this->cache[ $key ] ?? $default;
    }
    public function set($key, $value, $ttl = null)
    {
        $this->cache[$key] = $value;
        return true;
    }
    public function delete($key)
    {
        unset($this->cache[$key]);
        return true;
    }
    public function clear()
    {
        $this->cache = [];
        return true;
    }
    public function has($key)
    {
        return array_key_exists($key, $this->cache);
    }
    /**
     * @param array<mixed> $keys
     * @param mixed $default
     * @return array<mixed>
     */
    public function getMultiple($keys, $default = null)
    {
        throw new \Exception('Not implemented');
    }
    
    /**
        * @param array<mixed> $values
        */
    public function setMultiple($values, $ttl = null)
    {
        throw new \Exception('Not implemented');
    }
    /**
        * @param array<mixed> $keys
        */
    public function deleteMultiple($keys)
    {
        throw new \Exception('Not implemented');
    }
}
