$expiry) { if ($now > $expiry) { unset( self::$cache[$path], self::$timeouts[$path] ); } else { break; } } }, 1000, ["keep_alive" => false]); } public static function get($path) { return isset(self::$cache[$path]) ? self::$cache[$path] : null; } public static function set($path, array $stat) { if (self::$ttl <= 0) { return; } if (empty(self::$isInitialized)) { self::init(); } self::$cache[$path] = $stat; self::$timeouts[$path] = self::$now + self::$ttl; } public static function ttl($seconds) { self::$ttl = (int) $seconds; } public static function clear($path = null) { if (isset($path)) { unset( self::$cache[$path], self::$timeouts[$path] ); } else { self::$cache = []; self::$timeouts = []; } } }