Re: Function Cache

From: Date: Sun, 10 Dec 2000 13:32:39 +0000
Subject: Re: Function Cache
References: 1  Groups: php.dev php.pear 
Request: Send a blank email to php-dev+get-40745@lists.php.net to get a copy of this message
Sebastian Bergmann wrote: > > Uh-huh, > > I couldn't possibly imagine what a simple idea of Ulf Wendel, Johann-Peter > Hartmann and myself and a first implemenation of that idea given to Kristian > Köhntopp would yield such a hot discussion on php-dev@. > > Anyways, I hope the heat of "the battle" has ceased and we can discuss > that implemenation of Function Caching in native PHP of mine now a little, > since I don't see an implemenation as suggested by Kris likely to come up > anytime soon. > > Sterling Hughes asked me if I wanted to commit the code I currently have, > which works quite nicely with global variables and was not yet tested with > the Shared Memory implementation, to PEAR, so that other developers could > step easily in and enhance it. > > Certainly I would like to commit it to the PEAR cvs, but want to ask here > before I do so. > > You can have a look at what's currently there at > > - http://gravedancer.rc5.de/cache.phps > - http://gravedancer.rc5.de/cache_test.phps 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); ...from this point, $cached can be used exactly like $obj (all variable and method accesses go through the proxy object). A storage model similar to ext/session could be adapted, at the very least you should have "user" (maybe more constructor parameters with callback function names). For functions, I don't have any ideas that would be as elegant (for the programmer) as this. - Stig

« previous php.dev (#40745) next »