/** * Sets the value of a key. * * @param string $key * @param mixed $value Can be any of serializable data type. * * @return bool True if the set was successful, false if it was unsuccessful. * * @throws \InvalidArgumentException * @throws InternalException */ public function set($key, $value) { Util::checkArgString($key); Util::checkArgSerializable($value); try { return $this->getAdapter()->set($key, $value); } catch (\Exception $e) { throw new InternalException($e->getMessage(), $e->getCode(), $e); } }
/** * Removes the existing timeout on key, turning the key from volatile (a key with an expire set) * to persistent (a key that will never expire as no timeout is associated). * * @param string $key * * @return bool True if the persist was success, false if the persis was unsuccessful. * * @throws \InvalidArgumentException * @throws InternalException */ public function persist($key) { Util::checkArgString($key); try { return $this->getAdapter()->persist($key); } catch (\Exception $e) { throw new InternalException($e->getMessage(), $e->getCode(), $e); } }