@param string $key
@param string $value
@param int    $ttl

@return void
191535
public function do_set($key, $value, $ttl)
    {
        $file = $this->_getFileName($key);

        $dir = dirname($file);
        if (!@mkdir($dir, 0755, true) && !is_dir($dir)) {
            throw new CreateDirectoryFailedException(['create `:dir` cache directory failed: :last_error_message', 'dir' => $dir]);
        }

        if (file_put_contents($file, $value, LOCK_EX) === false) {
            throw new WriteFileFailedException(['write `:file` cache file failed: :last_error_message', 'file' => $file]);
        }

        @touch($file, time() + $ttl);
        clearstatcache(true, $file);
    }
1178429
public function set($key, $value, $ttl = 0) {
        if (is_resource($value)) {
            return false;
        }
        $used_key = $this->getUsedKey($key);
        $res = $this->redis->set($used_key, $this->esc($value));

        if ($res !== 'OK') {
            return false;
        }

        if ($ttl === 0) {
            return true;
        }
        if ($ttl != 0 && $ttl > 2592000) {
            $ttl -= time();
        }
        if ($ttl <= 0) {
            return true;
        }

        return ($this->redis->expire($used_key, $ttl) == 1);
    }
817961
public function set($key, $value, $ttl = null)
    {
        if ($this->enabled()) {
            return $this->manager->set($key, $value, $ttl);
        }

        return $value;
    }
789101
public function set($key, $value, $ttl = null, $nx = false)
    {
        $this->log(__FUNCTION__, $key);
        return $this->persistence->set($key, $value, $ttl, $nx);
    }
1105002
public function set($key, $value, $ttl)
    {
        if ($value === false) {
            throw new InvalidValueException(['`:key` key cache value can not `false` bool value', 'key' => $key]);
        } elseif (is_scalar($value) || $value === null) {
            if (is_string($value) && $value !== '' && $value[0] !== '{' && $value[0] !== '[') {
                $data = $value;
            } else {
                $data = json_encode(['_wrapper_' => $value], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            }
        } elseif (is_array($value) && isset($value['_wrapper_'])) {
            $data = json_encode(['_wrapper_' => $value], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
        } else {
            $data = json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
        }

        if ($data === false) {
            throw new InvalidValueException([
                '`:key` key cache value json_encode failed: `:code` `:message`',
                'key' => $key,
                'code' => json_last_error(),
                'message' => json_last_error_msg()
            ]);
        }

        $this->do_set($key, $data, $ttl);
    }
1121168
public function set($key, $value, $ttl = null)
    {
        $item = new Item($key, $value);
        if ($ttl !== null) {
            $item->expiresAfter($ttl);
        }
        return $this->save($item);
    }
66227
public function set($key, $value, $ttl = null)
    {
        $ttl = is_null($ttl) ? $this->ttl : $ttl;

        return $this->client->set($this->getKey($key), $value, $ttl);
    }
884839
public function set($key, $value, $ttl = null, array $tags = []): bool
    {
        return $this->setMultiple([$key => $value], $ttl, $tags);
    }
1033146
public function saveItem($key, $value, $ttl = null)
    {
        $cache = [
            'start' => time(),
            'ttl'   => ($ttl !== null) ? (int) $ttl : $this->ttl,
            'value' => $value,
        ];

        $this->memcached->set($key, $cache, $cache['ttl']);

        return $this;
    }
1255778
public function set($key, $value, $ttl)
    {
        if (!$this->memcached->set($key, $value, $ttl)) {
            // If set() returns false, that means the key already exists,
            return $this->memcached->replace($key, $value, $ttl);
        } else {
            // set() returned true, so the key has been set successfully
            return true;
        }
    }
596084
public function saveItem($key, $value, $ttl = null)
    {
        if (!$this->hasItem($key)) {
            $cacheFile = __cache_path().md5($key);
            $fileHandling = new FileHandling();
            $fileHandling->open($cacheFile, 'writeAppend')->write(json_encode([
                'start' => time(),
                'ttl'   => ($ttl !== null) ? (int) $ttl : $this->ttl,
                'value' => $value,
            ]));
            $fileHandling->close();
        }

        return $this;
    }
1296490
public function setTtl($key, $ttl) {
        $redis = $this->_getRedisClient();
        $redis->expire($this->_getInternalKey($key), $ttl);
    }
584756
public function set($key, $value, $ttl = null)
    {
        $values = $this->readFileContents();

        $values[$key] = [];

        $values[$key][self::VALUE] = $value;
        $values[$key][self::TTL] = $ttl;
        $values[$key][self::CREATE_TIME] = time();

        return $this->writeFileContents($values);
    }
1036433
public function set($key, $data, $ttl = null)
    {
        if ($ttl) {
            $now = new \DateTime('now', new \DateTimeZone('UTC'));
            $expire = (int) $now->format('U') + $ttl;
        } else {
            $expire = 0;
        }

        $entry = array(
            'expire' => $expire,
            'value' => $data
        );

        $this->storage[$key] = $entry;

        return true;
    }
788545
public function set(string $key, $value, int $ttl = null): void
    {
        $keyMD5 = md5($key);
        $key = $this->keyPrefix . substr($keyMD5, 0, 3) . '/' . substr($keyMD5, 3) . '.2';
        $this->dataRepository->setValue($key, gzcompress(serialize([$ttl > 0 ? time() + $ttl : 0, $value])));
    }
521794
public function set($entry, $value, $ttl = false)
    {
        $setCallback = function ($setSuccess, $cache) use ($entry, $value, $ttl) {
            return $setSuccess || $cache->set($entry, $value, $ttl);
        };
        return array_reduce($this->caches, $setCallback, false);
    }
309292
public function store($key, $value, $ttl = self::DEFAULT_TTL) {
        $this->storage[$key]      =   array('value' => $value, 'expires' => ($ttl) ? time() + $ttl : 0);
        return $value;
    }