/** * Purges half of the items in the cache, removing the least recently used. */ private static function purgeLru() { usort(self::$statCache, function ($a, $b) { return $a['time'] > $b['time'] ? 1 : ($a['time'] < $b['time'] ? -1 : 0); }); self::$statCache = array_slice(self::$statCache, 0, 500); }