* @license GPL2 or any later version * @since Stud.IP 3.3 * * @property array $id alias for pk * @property string $cache_key database column * @property string $operation database column * @property string $parameters database column * @property int $mkdate database column * @property int $chdate database column */ class StudipCacheOperation extends SimpleORMap { /** * Configures the model. * * @param Array $config The config settings */ public static function configure($config = []) { $config['db_table'] = 'cache_operations'; parent::configure($config); } /** * Applies any pending cache operation to the passed cache object. * The operations are applied in chronological order and are deleted * from the database after they have been applied. * * @param Cache $cache The cache object to apply the operations to */ public static function apply(Cache $cache) { self::findEachBySQL(function (StudipCacheOperation $item) use ($cache): void { $parameters = unserialize($item->parameters); array_unshift($parameters, $item->cache_key); call_user_func_array([$cache, $item->operation], $parameters); $item->delete(); }, '1 ORDER BY chdate ASC'); } }