/** * Removes a context from the cache. * * @static * @param context $context Context object to remove * @return void */ protected static function cache_remove(context $context) { if (!isset(self::$cache_contextsbyid[$context->id])) { // not cached, no need to do anything - this is relatively cheap, we do all this because count() is slow return; } unset(self::$cache_contexts[$context->contextlevel][$context->instanceid]); unset(self::$cache_contextsbyid[$context->id]); self::$cache_count--; if (self::$cache_count < 0) { self::$cache_count = 0; } }