Menu

#34 Caching of PHP-Functions possible?

closed
nobody
None
5
2003-10-14
2003-10-14
Anonymous
No

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

Discussion

  • Dmitry Stogov

    Dmitry Stogov - 2003-10-14

    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.

     
  • Dmitry Stogov

    Dmitry Stogov - 2003-10-14
    • status: open --> closed
     

Log in to post a comment.