Ticket #179 (assigned enhancement)
新 API 建议
Description
一般情况下,在执行的 PHP 脚本中,很少会只用一次两次的 var cache。
都会这么写: foreach ($data AS $key => $value) {
xcache_set($key, $value, $ttl);
}
xcache_get 也基本上差不多,尤其在把数据库的记录当作一个 key -> value 对存在的时候,往往做一个列表页的情况下,会进行很大批量的 get 和 set 操作。从性能开销的考虑来看,由 xcache 支持批量操作,速度会提升 5-10 倍。目前 APC 和 MEMCACHE 的 get 操作都支持批量 key 的存取。我想除了方便的角度,也有性能提升的考虑吧。
我设想增加 xcache_gets API,原型为:
array xcache_gets(array $keys, [array &$unget_keys])
变量 keys 为一批 key,变量 unget_keys 为在缓存中未获得到的 key 的数组。方便后期代码中进行数据的获取,而不需要再进行循环操作。
如果可以的话,也可以增加 xcache_sets 函数,原型为:
bool xcache_sets(array $data, $ttl)
变量 $data 为 key -> $value 对。
以上建议请希望开发者慎重考虑~
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

