diff --git a/src/Prettus/Repository/Traits/CacheableRepository.php b/src/Prettus/Repository/Traits/CacheableRepository.php index 28b229d5..efc6a669 100644 --- a/src/Prettus/Repository/Traits/CacheableRepository.php +++ b/src/Prettus/Repository/Traits/CacheableRepository.php @@ -340,4 +340,18 @@ public function getByCriteria(CriteriaInterface $criteria) $this->resetScope(); return $value; } + + /** + * Clear cache + * + * @return void + */ + public function clearCache() + { + $keys = CacheKeys::getKeys(get_called_class()); + + foreach ($keys as $key) { + $this->getCacheRepository()->forget($key); + } + } }