Esempio n. 1
0
 /**
  * Set the reference
  *
  * @param string $key
  * @param string $reference
  *
  * @throws \InvalidArgumentException
  */
 public function setReference($key, $reference)
 {
     if ($this->getModel($reference) === null) {
         throw new \InvalidArgumentException(sprintf('The reference "%s" does not exist', $reference));
     }
     if (($model = $this->getModel($key)) === null) {
         $model = new CacheModel();
     }
     $model->tstamp = time();
     $model->uid = $key;
     $model->reference = $reference;
     $model->obsolete = '';
     $model->save();
 }