rosavox/lib/alveolata/cache/implementation-memory/wrapper-class.php

49 lines
1.2 KiB
PHP
Raw Normal View History

2025-05-23 07:33:29 +00:00
<?php
namespace alveolata\cache;
// require_once(DIR_ALVEOLATA . '/definitions.php');
require_once(DIR_ALVEOLATA . '/cache/implementation-memory/functions.php');
require_once(DIR_ALVEOLATA . '/cache/abstract/interface.php');
/**
* @author Christian Fraß <frass@greenscale.de>
*/
class implementation_memory implements interface_cache
{
/**
* @var struct_subject_memory
* @author Christian Fraß <frass@greenscale.de>
*/
private $subject;
/**
* @var struct_subject_memory $subject
* @author Christian Fraß <frass@greenscale.de>
*/
private function __construct(struct_subject_memory $subject) {$this->subject = $subject;}
/**
* @return implementation_memory
* @author Christian Fraß <frass@greenscale.de>
*/
public static function make() : implementation_memory {return (new static(memory_make()));}
/**
* @implementations
*
* @author Christian Fraß <frass@greenscale.de>
*/
public function set(string $id, $value) : void {memory_set($this->subject, $id, $value);}
public function has(string $id) : bool {return memory_has($this->subject, $id);}
public function fetch(string $id) {return memory_fetch($this->subject, $id);}
public function clear() : void {memory_clear($this->subject);}
}