25 lines
493 B
PHP
25 lines
493 B
PHP
<?php
|
|
namespace PSC\Library\Calc;
|
|
|
|
class Cache {
|
|
private static $instance = null;
|
|
private $cache = [];
|
|
|
|
private function __construct() {}
|
|
|
|
public static function getInstance() {
|
|
if (self::$instance === null) {
|
|
self::$instance = new Cache();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
public function set($key, $value) {
|
|
$this->cache[$key] = $value;
|
|
}
|
|
|
|
public function get($key) {
|
|
return $this->cache[$key] ?? null;
|
|
}
|
|
}
|