summaryrefslogtreecommitdiff
path: root/tests/compare/memcached-v-filecache.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
commit7076343338ae3439f3c86f01144818abe8c31978 (patch)
tree794abb1e6b8f821091fd095341885496b6dad51d /tests/compare/memcached-v-filecache.php
parent47cbb529f5723b246125ae083a193e11481b89ef (diff)
downloadclassroom-7076343338ae3439f3c86f01144818abe8c31978.tar.gz
classroom-7076343338ae3439f3c86f01144818abe8c31978.tar.bz2
classroom-7076343338ae3439f3c86f01144818abe8c31978.zip
add container helpers; constuct public directory-tree
Diffstat (limited to 'tests/compare/memcached-v-filecache.php')
-rw-r--r--tests/compare/memcached-v-filecache.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/compare/memcached-v-filecache.php b/tests/compare/memcached-v-filecache.php
new file mode 100644
index 0000000..539b0c5
--- /dev/null
+++ b/tests/compare/memcached-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('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');
+Benchmark::render_report('code');
+
+echo "test completed!";
+die();
+
+