public function set($key, $value, $expire = 0)
{
// we don't really need a lock for this operation, but we need to make
// sure it's not locked by another operation, which we could overwrite
if (!$this->lock($key)) {
return false;
}
$expire = $this->normalizeTime($expire);
if ($expire !== 0 && $expire < time()) {
$this->unlock($key);
// don't waste time storing (and later comparing expiration
// timestamp) data that is already expired; just delete it already
return !$this->exists($key) || $this->delete($key);
}
$path = $this->path($key);
$data = $this->wrap($value, $expire);
$success = $this->filesystem->put($path, $data);
return $success !== false && $this->unlock($key);
}