set() public méthode

set last modified
public set ( string $key, mixed $value ) : void
$key string
$value mixed
Résultat void
 /**
  * Throttle
  *
  * @param string $key  - A unique key for what we're throttling
  * @param int $limit   - How many are allowed
  * @param int $milliseconds - In this many milliseconds
  * @return void
  */
 public function throttle($key, $limit, $milliseconds)
 {
     /**
      * Try do our waiting without a lock, so may sneak through because of
      * this...
      */
     $wait = $this->getEstimate($key, $limit, $milliseconds);
     if ($wait > 0) {
         usleep($wait * 1000);
     }
     $key = $this->getStorageKey($key, $limit, $milliseconds);
     $this->storage->lock($key);
     $count = $this->storage->get($key);
     $count++;
     $this->storage->set($key, $count);
     $this->storage->unlock($key);
     return $wait;
 }
 /**
  * Set Last Request
  *
  * @param string $key
  * @param float $request
  * @return void
  */
 protected function setLastRequest($key, $request)
 {
     return $this->storage->set($key . '::LASTREQUEST', $request);
 }