Hi,

I've implemented a $m->cache_self-like feature with memcached that looks
a little like this:

    my $cache = $m->comp("/cacheobj.md" ); # get the Cache::Memcached
object

    my $result = $cache->get($cache_key);
    if ($result) {
        $m->out($result);
        return;
    } else {
        my ($output, @retval, $error);
        if ( $m->call_self( \$output, [EMAIL PROTECTED], \$error ) ) {
            my $res = $cache->set($cache_key, $output, 60 * 60 * 6); # 6
hours
            $m->out($output);
            return;
        }
    }

This works well, but is a bit bulky to go cutting and pasting everywhere
that uses $m->cache_self, so I'd like to component-ize it.  That's
proving a bit tricky however, as I think instead of calling
$m->call_self, I'd have to somehow capture the output of the caller,
which I figure is impossible.

But I thought I'd ask -- does anyone have any clever solutions?

Thanks,
Dan




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to