I have a custom module in Drupal 7 where I am caching data from REST calls using drupal_static()
and cache_set()
.
function _mymodule_call() {
$data = &drupal_static(__FUNCTION__);
if ( ! isset($data) ) {
if ($cache = cache_get(__FUNCTION__)) {
$data = $cache->data;
}
else {
$data = my_api_call();
if ( is_object($lists) ) {
// cache for one hour
cache_set(__FUNCTION__, $data, 'cache', time() + 3600);
}
}
}
return $data;
}
I want to make an admin feature where we can specifically clear these cached values. I suppose the cache key would be _mymodule_call
. How do I clear them from the cache?