Caching of PHP-Functions possible?
Brought to you by:
dstogov
Hi,
is it possible to build a system into mmcache
that can cache a function?
e.g.
function count_all_1G_rows($arg_a, $arg_b)
{
mmcache_cache_me($ttl);
--very cpu - intensive code here--
return $ret;
}
So when I call the function a second time,
mmcache just returns the value of the last
function-call.
e.g.:
$res=count_all_1G_rows(1,5);
//1 Minute later
echo $res;
$res=count_all_1G_rows(1,5);
//milliseconds later
echo $res;
//=the same result
Logged In: YES
user_id=124551
Yes it is possible, but in some different way:
$res = mmcache_cache_result
("some_key", "count_all_1G_rows(1,5)")
echo $res;
$res = mmcache_cache_result
("some_key", "count_all_1G_rows(1,5)")
echo $res;
See MMCache API section in README for more info.