mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Update to API 12
This commit is contained in:
parent
731ada7b38
commit
c59b4776ae
149 changed files with 6850 additions and 1918 deletions
|
|
@ -21,26 +21,27 @@
|
|||
|
||||
class Cache{
|
||||
public static $cached = array();
|
||||
|
||||
|
||||
public static function add($identifier, $blob, $minTTL = 30){
|
||||
self::$cached[$identifier] = array($blob, microtime(true) + $minTTL);
|
||||
self::$cached[$identifier] = array($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){
|
||||
|
|
@ -50,4 +51,4 @@ class Cache{
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue