So I have a single method that generated a cache key and also applies a transient automatically.
Here is the method:
private function get_cache($id, $count)
{
$cache_key = $this->generate_cache_key($id, $count);
return get_transient($cache_key);
}
How could I make that method return both the $cache_key
but also get_transient
?
Here is what I'm trying to achieve:
- Access the $cache_key inside another method.
- Also execute the get_transient when calling the method.
I have a method and this is what I'm aiming to achieve:
public function delete_cache($count = 4)
{
$cache_key = $this->get_cache['cache_key'];
var_dump($cache_key);
}
So I was thinking something like $instagram->get_cache['cache_key']
but also keep the original functionality for:
if ($cached = $instagram->get_cache($instagram->user_id, $count)) {
return $cached;
}
Does anyone know how I can get the cache_key for another method, but still keep the get_transient return?