Re: Re: XML/RPC/Cached_Server ?
| From: | Pierre-Alain Joye | Date: | Tue, 30 Aug 2005 08:10:19 +0000 |
| Subject: | Re: Re: XML/RPC/Cached_Server ? | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39620@lists.php.net to get a copy of this message | ||
On Tue, 30 Aug 2005 10:06:36 +0200
schst@php-tools.de (Stephan Schmidt) wrote:
> class XML_RPC_Interceptor_Cache {
>
> var $sig;
>
> function interceptRequest($method, $params) {
> $sig = md5($method . serialize($params));
> $this->sig = $sig;
> $result = $this->cache->get($sig);
> echo $result;
> // returning false will stop the request
> return false;
> }
>
> function interceptResponse($response) {
> $this->cache->store($sig, $response);
> return true;
> }
> }
>
> $cache = new XML_RPC_Interceptor_Cache();
> $server = new XML_RPC_Server();
> $server->addInterceptor($cache);
> $server->service();
>
> This would be a lot more transparent and flexible as you could
> easly add gzip support to the server, add IP-based authentication
> for some function or whatever you need directly in the server.
>
> What do you think about it? Should not be very hard to add to
> XML_RPC2...
You need 2 caches anyway. One for the client and one for the
server, both being classic cache usages... Fail to see the problem
or needs for extra packages, classes or other similar things.
--Pierre