Skip to content

Instantly share code, notes, and snippets.

@naveed125
Last active September 10, 2018 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naveed125/69d39a99510dac91757258ff579310c1 to your computer and use it in GitHub Desktop.
Save naveed125/69d39a99510dac91757258ff579310c1 to your computer and use it in GitHub Desktop.
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