private function prepareExpiration($expiration)
 {
     if ($expiration != KeyValue::NO_EXPIRE) {
         $keyValue = new KeyValue('', '');
         $keyValue->setExpirationInSeconds($expiration);
         $expiration = $keyValue->getExpirationTimestamp();
     }
     return $expiration;
 }
Exemplo n.º 2
0
 /**
  * @param KeyValue $keyValue
  */
 public function create(KeyValue $keyValue)
 {
     $existentkeyValue = $this->findElementWithNoException($keyValue->getKey(), $keyValue->getNamespace());
     if ($existentkeyValue) {
         $existentkeyValue->setValues($keyValue->getKey(), $keyValue->getValue(), $keyValue->getNamespace(), $keyValue->getExpirationTimestamp());
     } else {
         $this->dm->persist($keyValue);
     }
     $this->flush();
 }