Beispiel #1
0
 /**
  * delSessionRef - delete sessions containing a specific reference
  *
  * @param  string  $ref
  * @return boolean
  */
 public function delSessionRef($ref)
 {
     $refs = $this->cache->Get($this->cache_ref_key);
     if (is_array($refs)) {
         foreach ($refs as $key => $data) {
             if (key($data) == $ref) {
                 unset($refs[$key]);
                 if (!$this->cache->Delete($key)) {
                     return false;
                 }
             }
         }
         return (bool) $this->cache->Set($this->cache_ref_key, $refs, 3600);
     } else {
         return false;
     }
 }
Beispiel #2
0
<?php

require_once '../../MPLT.php';
$timer = new MPLT();
/**
 * using composer autoloader PSR-0
 */
require_once '../../vendor/autoload.php';
$cache = new DALMP\Cache\Memcache('127.0.0.1', 11211, 1, 1);
$cache->set('mykey', 'xpto', 300);
var_dump($cache->get('mykey'));
$cache->X()->replace('mykey', 'otpx', false, 300);
var_dump($cache->get('mykey'));
#------------------------------------------------------------------------------
echo PHP_EOL, str_repeat('-', 80), PHP_EOL, 'Time: ', $timer->getPageLoadTime(), ' - Memory: ', $timer->getMemoryUsage(1), PHP_EOL, str_repeat('-', 80), PHP_EOL;