protected function store($method, $index, $value, $expires = Cache::EXPIRES_MINIMUM) { if ($expires === Cache::DO_NOT_CACHE) { return false; } $flags = 0; if (!is_numeric($value)) { if (is_string($value)) { $packed = $value; } else { $packed = serialize($value); $flags |= 1; } if ($this->compress) { $compressed = gzcompress($packed); if (strlen($compressed) < strlen($packed)) { $packed = $compressed; $flags |= 2; unset($compressed); } } } elseif (Assert::checkFloat($value) && (int) $value != (double) $value) { $packed = serialize($value); $flags |= 1; } else { $packed = $value; } $lenght = strlen($packed); $command = "{$method} {$index} {$flags} {$expires} {$lenght}\r\n{$packed}\r\n"; if (!$this->sendRequest($command)) { return false; } $response = fread($this->link, $this->buffer); if ($this->isTimeout()) { return false; } if ($response === "STORED\r\n") { return true; } return false; }