Skip to content

Instantly share code, notes, and snippets.

@naveed125
Last active Sep 10, 2018
Embed
What would you like to do?
A singleton application cache
<?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