private function cacheGc() {
    $probMax = 1 / self::GC_PROB;
    $do = rand(1, $probMax);
    if($do > 1) {
      /* Skipping GC this time. */
      return false;
    }
    $cahceIds = $this->store->listIds('cache');
    foreach($cahceIds as $cahceId) {
      try {
        $data = $this->store->read('cache', $cahceId);
      } catch (\phpSec\Exception $e) {
        /* Skip this. */
        continue;
      }

      if($data['ttl'] < time()) {
        $this->store->delete('cache', $cahceId);
      }
    }
    return true;
  }
private function cacheGc() {
    $probMax = 1 / self::GC_PROB;
    $do = rand(1, $probMax);
    if($do > 1) {
      /* Skipping GC this time. */
      return false;
    }
    $cahceIds = $this->store->listIds('cache');
    foreach($cahceIds as $cahceId) {
      try {
        $data = $this->store->read('cache', $cahceId);
      } catch (\phpSec\Exception $e) {
        /* Skip this. */
        continue;
      }

      if($data['ttl'] < time()) {
        $this->store->delete('cache', $cahceId);
      }
    }
    return true;
  }
private function cacheGc ( ) { $ probMax = 1 / self :: GC_PROB ; $ do = rand ( 1 , $ probMax ) ; if ( $ do > 1 ) { /* Skipping GC this time. */ return false ; } $ cahceIds = $ this -> store -> listIds ( 'cache' ) ; foreach ( $ cahceIds as $ cahceId ) { try { $ data = $ this -> store -> read ( 'cache' , $ cahceId ) ; } catch ( \ phpSec \ Exception $ e ) { /* Skip this. */ continue ; } if ( $ data [ 'ttl' ] < time ( ) ) { $ this -> store -> delete ( 'cache' , $ cahceId ) ; } } return true ; }
Do garbage collection on cached data.
Do garbage collection on cached data .