mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
removed advanced cache
This commit is contained in:
parent
1bbe5c7582
commit
80d78faecd
5 changed files with 3 additions and 63 deletions
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Cache{
|
||||
|
||||
public static $cached = [];
|
||||
|
||||
public static function add($identifier, $blob, $minTTL = 30){
|
||||
self::$cached[$identifier] = [$blob, microtime(true) + $minTTL, $minTTL];
|
||||
}
|
||||
|
||||
public static function get($identifier){
|
||||
if(isset(self::$cached[$identifier])){
|
||||
self::$cached[$identifier][1] = microtime(true) + self::$cached[$identifier][2];
|
||||
return self::$cached[$identifier][0];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function exists($identifier){
|
||||
return isset(self::$cached[$identifier]);
|
||||
}
|
||||
|
||||
public static function remove($identifier){
|
||||
unset(self::$cached[$identifier]);
|
||||
}
|
||||
|
||||
public static function cleanup(){
|
||||
$time = microtime(true);
|
||||
foreach(self::$cached as $index => $data){
|
||||
if($data[1] < $time){
|
||||
unset(self::$cached[$index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue