for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class BBCache
*
* @filesource BBCache.php
* @created 26.04.2018
* @package chillerlan\BBCode
* @author smiley <[email protected]>
* @copyright 2018 smiley
* @license MIT
*/
namespace chillerlan\BBCode;
use Psr\SimpleCache\CacheInterface;
final class BBCache implements CacheInterface{
* @var array
protected $cache = [];
* @inheritdoc
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]);
public function clear(){
$this->cache = [];
public function getMultiple($keys, $default = null){
$data = [];
foreach($keys as $key){
$data[$key] = $this->cache[$key] ?? $default;
return $data;
public function setMultiple($values, $ttl = null){
foreach($values as $key => $value){
public function deleteMultiple($keys){
public function has($key){
return isset($this->cache[$key]);