diff options
Diffstat (limited to 'tests/compare/redis-v-filecache.php')
| -rwxr-xr-x | tests/compare/redis-v-filecache.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/compare/redis-v-filecache.php b/tests/compare/redis-v-filecache.php new file mode 100755 index 0000000..3cb6536 --- /dev/null +++ b/tests/compare/redis-v-filecache.php @@ -0,0 +1,35 @@ +<?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('redis-set-start'); +foreach($products as $product) { + RedisCache::set('prod'.$product['ID'], $product, 600); +} + +Benchmark::add_spot('redis-get-start'); +foreach($products as $product) { + $x = RedisCache::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(); + + |
