summaryrefslogtreecommitdiff
path: root/tests/compare/memcached-v-filecache.php
blob: 4ffdfed89b8a28a3bdfacf0d77848f3fbdf6d59e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php 
echo "test started... ";
ob_flush();

Benchmark::add_spot('query-10000-products');
$db = Registry::use('database');
$products = $db->runQuery("SELECT * FROM products LIMIT 10000",[]);

Benchmark::add_spot('memcached-set-start');
foreach($products as $product) {
    MemcachedCache::set('prod'.$product['ID'], $product, 600);
}

Benchmark::add_spot('memcached-get-start');
foreach($products as $product) {
    $x = MemcachedCache::get('prod'.$product['ID']);
}

Benchmark::add_spot('filecache-set-start');
foreach($products as $product) {
    FileCache::set('prod'.$product['ID'], $product, 600);
}

Benchmark::add_spot('filecache-get-start');
foreach($products as $product) {
    $x = FileCache::get('prod'.$product['ID']);
}

Benchmark::add_spot('end');
echo(Benchmark::report(BENCH_REPORT_COMMENT));
echo "test completed!";

die();