XML/RPC/Cached_Server ?
| From: | Fabien MARTY | Date: | Mon, 29 Aug 2005 20:25:06 +0000 |
| Subject: | XML/RPC/Cached_Server ? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-39615@lists.php.net to get a copy of this message | ||
Hi,
I'm the maintener of the PEAR/Cache/Lite package. As there is some
discuss about PEAR/XML/RPC, I would like to propose the add of a
Cached_Server to the XML/RPC package.
This Cached_Server.php file is under tests. So, there is no source
code to see for now. But, the idea is to interface Cache/Lite/Output
and XML/RPC/Server. The interface is not trivial because the main idea
is to be able to give a particular cache lifetime at each xml_rpc
function with a cache map. So you can cache only some functions... or
cache all functions.
Even without function calls, perfs are two times better.
What to you think about this potential add ?
An exemple of the API :
<?php
require_once 'Cached_Server.php';
// [...]
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 60,
'pearErrorMode' => CACHE_LITE_ERROR_DIE,
'cacheByDefault' => true,
'cacheMap' => array(
'xmlrpc_function_to_cache_for_an_hour' => 3600,
'xmlrpc_function_to_cache_for_ten_minutes' => 600,
'xmlrpc_function_not_to_cache' => 0
)
);
$server = new XML_RPC_Cached_Server($options,
array(
'xmlrpc_function_to_cache_for_an_hour' =>
array(
'function' => 'xmlrpc_function_to_cache_for_an_hour'
),
'xmlrpc_function_to_cache_for_ten_minutes' =>
array(
'function' => 'xmlrpc_function_to_cache_for_ten_minutes'
),
'xmlrpc_function_not_to_cache' =>
array(
'function' => 'xmlrpc_function_not_to_cache'
),
'xmlrpc_functions_cached_by_default' =>
[...],
)
);
?>
--
Fabien MARTY
fabien.marty@free.fr