Esempio n. 1
0
 /**
  * @param Token $token
  *
  * @return bool
  * @throws \UnexpectedValueException
  */
 public function storeToken(Token $token)
 {
     $dbh = $this->getPdo();
     $stmt = $dbh->prepare("REPLACE INTO {$this->table} (`id`,`value`,`eol_timestamp`) VALUES (1,:value,:eol_timestamp)");
     $stmt->execute(array('value' => $token->getValue(), 'eol_timestamp' => $token->getEolTimestmap()));
     $rowCount = $stmt->rowCount();
     if ($rowCount == 0) {
         throw new \UnexpectedValueException("Could not insert token into the '{$this->table}' table.");
     }
     return true;
 }
Esempio n. 2
0
 /**
  * @param Token $token
  *
  * @return bool
  * @throws \UnexpectedValueException
  */
 public function storeToken(Token $token)
 {
     $memcached = $this->getMemcached();
     return $memcached->set($this->key, array('value' => $token->getValue(), 'eol_timestamp' => $token->getEolTimestmap()));
 }