I’m trying to implement a cache system but I’m having problem to pass paramenters fo the cache callable function.
Example:
$slug = "test";
$model = MyModel::getDb()->cache(function ($db) {
return MyModel::find()->with(['something'])->where(['slug' => $slug])->one();
});
How can I pass the $slug variable to inside the function called on cache()?