/** * @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; }
/** * @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())); }