Skip to content

Instantly share code, notes, and snippets.

@eb-eoliveira
Created February 20, 2013 02:10
Show Gist options
  • Save eb-eoliveira/4992114 to your computer and use it in GitHub Desktop.
Save eb-eoliveira/4992114 to your computer and use it in GitHub Desktop.
Fatcache simple test
<?php
$m = new Memcached();
$m->addServer('localhost', 11211, 33);
$items = 100000;
$start = time();
for ($i = 1; $i <= $items; ++$i) {
$key = md5(rand());
$value = md5(rand()). md5(rand()) . md5(rand()) . md5(rand()) . md5(rand());
$m->set($key, $value, rand(60, 600));
// $m->get($key);
}
$end = time();
echo "\nSummary\n";
echo "Items: $items\n";
echo "Start time: $start\n";
echo "End time: $end\n";
echo "Operations/s: " . ($items/($end-$start)) . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment