performance optimizations
This commit is contained in:
@@ -4,10 +4,7 @@ class mfValuecache {
|
||||
public static $instance;
|
||||
public $cache = [];
|
||||
|
||||
|
||||
private function __construct() {
|
||||
|
||||
}
|
||||
private function __construct() { }
|
||||
|
||||
public static function singleton() {
|
||||
if(!isset(self::$instance)) {
|
||||
@@ -17,16 +14,18 @@ class mfValuecache {
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public static function get($key) {
|
||||
$instance = self::singleton();
|
||||
if(array_key_exists($key, $instance->cache)) {
|
||||
return $instance->cache[$key];
|
||||
public function get($key) {
|
||||
if(array_key_exists($key, $this->cache)) {
|
||||
return $this->cache[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function set($key, $value) {
|
||||
$instance = self::singleton();
|
||||
$instance->cache[$key] = $value;
|
||||
public function set($key, $value) {
|
||||
$this->cache[$key] = $value;
|
||||
}
|
||||
|
||||
public function getCache() {
|
||||
return $this->cache;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user