query((new SqlFieldsQuery('MERGE INTO performance_cache(ckey,cvalue) VALUES(?,?)'))->setSchema('PUBLIC')->setArgs($key, $value))->getAll(); } define('N', 10000); function test($cache) { // put speed $t1 = gettimeofday(TRUE); for($i = 0; $i < N; $i++) { put($cache, 'K#' . ($i + 1), $i + 1); } $t2 = gettimeofday(TRUE); echo sprintf("%d puts per second\r\n", (int)(N / ($t2 - $t1))); } define('REP', 5); $cli = new Client(); $cli->connect(new ClientConfiguration('localhost:10800')); $cache = $cli->getOrCreateCache('dummy', (new CacheConfiguration())); $cache->query((new SqlFieldsQuery('CREATE TABLE IF NOT EXISTS performance_cache (ckey VARCHAR(16) NOT NULL, cvalue INTEGER NOT NULL, PRIMARY KEY(ckey))'))->setSchema('PUBLIC'))->getAll(); for($i = 0; $i < REP; $i++) { test($cache); } $cli->disconnect(); ?>