Closed oddnavy closed 3 years ago
@brandonkelly / Craft team it would be great if you could take a quick look at this one
@angrybrad / anyone? Would love to get this merged if possible
FYI we did something similar for Orders from Commerce:
Event::on(
Order::class,
Order::EVENT_AFTER_COMPLETE_ORDER,
function(Event $event) {
BusinessLogic::$instance->api->invalidateCache();
}
);
public function invalidateCache()
{
TagDependency::invalidate(Craft::$app->getCache(), 'element-api');
}
Replicated from craftcms GraphQL implementation to make it possible to clear the element-api cache without resorting to
cache->flush()
.We'd like to programmatically clear the element-api cache when entries are saved using TagDependency.
For example: