Re: Re: Function Cache

From: Date: Mon, 11 Dec 2000 09:38:49 +0000
Subject: Re: Re: Function Cache
References: 1 2 3  Groups: php.dev php.pear 
Request: Send a blank email to php-dev+get-40799@lists.php.net to get a copy of this message
Kristian Koehntopp wrote: > > 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. How do you think the Java and COM extensions work? :-) - Stig

« previous php.dev (#40799) next »