/** * @param MCacheItem $item * @return bool */ public function addItem(MCacheItem $item) { $i = 0; $stmt = $this->pdoConnection->prepare(sprintf(self::$UPSERT, $this->tableName)); $stmt->bindParam(++$i, $item->getKey(), \PDO::PARAM_STR); $stmt->bindParam(++$i, $item->getValue(), \PDO::PARAM_STR); $stmt->bindParam(++$i, $item->getTtl(), \PDO::PARAM_INT); $stmt->bindParam(++$i, $item->getTtl(), \PDO::PARAM_INT); $stmt->bindParam(++$i, $item->getValue(), \PDO::PARAM_STR); $stmt->bindParam(++$i, $item->getTtl(), \PDO::PARAM_INT); $stmt->bindParam(++$i, $item->getTtl(), \PDO::PARAM_INT); return $stmt->execute(); }
/** * @param MCacheItem $item * @return array */ public static function toArray(MCacheItem $item) { return array('key' => $item->getKey(), 'value' => $item->getValue(), 'ttl' => $item->getTtl()); }