<?php

use GW2Spidy\Dataset\GemExchangeDataset;
use GW2Spidy\Dataset\DatasetManager;
use GW2Spidy\Util\RedisCacheHandler;
require dirname(__FILE__) . '/../autoload.php';
$data = DatasetManager::getInstance()->getGemDataset(GemExchangeDataset::TYPE_GEM_TO_GOLD);
$plain = serialize($data);
$loops = 1000;
$oSerAndG = RedisCacheHandler::getInstance('ser_and_g', true, 0, true);
$oSerNoG = RedisCacheHandler::getInstance('ser_no_g', true, 0, false);
$oPlain = RedisCacheHandler::getInstance('plain', false, 0, false);
$sSerAndG = $oSerAndG->prepareValue($data);
$sSerNoG = $oSerNoG->prepareValue($data);
echo "strlen \n";
echo "with gzip length    [[ " . strlen($sSerAndG) . " ]] \n";
echo "without gzip length [[ " . strlen($sSerNoG) . " ]] \n";
echo "plain               [[ ------ ]] \n";
$time = microtime(true);
for ($i = 0; $i < $loops; $i++) {
    $oSerAndG->prepareValue($data);
}
$iSerAndG = microtime(true) - $time;
$time = microtime(true);
for ($i = 0; $i < $loops; $i++) {
    $oSerNoG->prepareValue($data);
}
$iSerNoG = microtime(true) - $time;
$time = microtime(true);
for ($i = 0; $i < $loops; $i++) {
    $oPlain->prepareValue($plain);
Example #2
0
 public function __construct()
 {
     $this->cache = RedisCacheHandler::getInstance('datasets', true, 3600);
 }