/** * Puts data into the cache. * * @access public * @param string $id The cache id. * @param mixed $data The cache entry/data. * @param int $lifeTime The lifetime in number of seconds for this cache entry. * If zero (the default), the entry never expires (although it may be deleted from the cache * to make place for other entries). */ public function save($id, $data, $lifetime = null) { if (Config::get('system.cache.enabled')) { if ($lifetime === null) { $lifetime = static::getLifetime(); } static::$driver->save($id, $data, $lifetime); } }
/** * Remove one triplet of the user from the store * * @param mixed $credential * @param string $persistentToken */ public function cleanTriplet($credential, $persistentToken) { // Hash the tokens, because they can contain a salt and can be // accessed in the file system $persistentToken = sha1(trim($persistentToken)); // Delete token from storage $id = $this->getId($credential); if ($this->driver->contains($id)) { list($expire, $tokens) = $this->driver->fetch($id); unset($tokens[$persistentToken]); $this->driver->save($id, [$expire, $tokens], $expire); } }