Last active
September 10, 2018 03:58
-
-
Save naveed125/69d39a99510dac91757258ff579310c1 to your computer and use it in GitHub Desktop.
A singleton application cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LocalCache { | |
use Singleton; | |
protected store = []; | |
public function get($key, default = null) { | |
return isset($this->store[$key])) ? $this->store[$key] : $default; | |
} | |
public function set($key, $value) { | |
$this->store[$key] = $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment