cache_get
always returns an object and I'm a bit confused by its values. There's probably a short generic function that can handle this for once and for all.
$cache = cache_get('key');
if ($cache) {
// doesn't work, cache_get always returns an object
}
if (!$cache || ($cache->created < time() - $cache->expire)) {
// cache is expired? I'm not sure
}
Just checking for the data member doesn't cut it.
I had seen the issue reported on d.o (in 2009) but that doesn't really help me fix it on any live site. So I'm looking for a function that will still make cache work for me without resorting to storing the cache myself in the database.