Re: Re: Function Cache

From: Date: Sun, 10 Dec 2000 17:17:29 +0000
Subject: Re: Re: Function Cache
References: 1 2  Groups: php.dev php.pear 
Request: Send a blank email to php-dev+get-40748@lists.php.net to get a copy of this message
Stig S. Bakken wrote: > For objects, I think the best thing would be to create a function that > returns a proxy object. Then you can write code like this: > > $obj = new myclass(42); > $cached = new caching_proxy_object($obj); Hmm, is there a way to write a generic proxy class that can stand in for any class? I mean, if you call $cached->dosomething() how do you spare yourself to implement a dosomething() method in the proxy object? All methods in $cached would be implemented the same way: ob_start(), proxy call to $obj->dosomething(), then ob_get_contents() and ob_end_clear(). Do we already have _delegate() methods in Zend? That is, is there already a way to specifiy a method that gets called before Zend complains that there is no dosomething() method in $cached and that can intercept the error message? If so, it is indeed possible to write generic proxy objects, otherwise you need to generate distinct code for each proxy class. Kristian -- Kristian Köhntopp, NetUSE AG Siemenswall, D-24107 Kiel Tel: +49 431 386 436 00, Fax: +49 431 386 435 99 Using PHP3? See our web development library at http://phplib.netuse.de/

« previous php.dev (#40748) next »