Write to shared memory
@param  string $data Data
@param  integer $offset Offset
@return boolean         Success
558098
public function write($data, $offset)
    {
        $segno = floor($offset / $this->segsize);
        if (!isset($this->segments[$segno])) {
            if (!$this->open($segno, true)) {
                return false;
            }
        }
        $sOffset = $offset % $this->segsize;
        $d = $this->segsize - ($sOffset + mb_orig_strlen($data));
        if ($d < 0) {
            $this->write(mb_orig_substr($data, $d), ($segno + 1) * $this->segsize);
            $data = mb_orig_substr($data, 0, $d);
        }
        //Daemon::log('writing to #'.$offset.' (segno '.$segno.')');
        shmop_write($this->segments[$segno], $data, $sOffset);
        return true;
    }
726820
public function stream_write($data)
    {
        $tmp = &$this->_data[$this->_datapos];

        $oldlen = $tmp['l'];
        $res = fwrite($tmp['fp'], $data);
        if ($res === false) {
            return false;
        }

        $tmp['p'] = ftell($tmp['fp']);
        if ($tmp['p'] > $oldlen) {
            $tmp['l'] = $tmp['p'];
            $this->_length += ($tmp['l'] - $oldlen);
        }

        return $res;
    }
95938
protected function write(array $data)
    {
        $changes = $this->getChanges($data);

        $this->syncUpdated($changes['updated']);
        $this->syncInserted($changes['inserted']);
        $this->syncDeleted($changes['deleted']);
    }
809808
protected function _fwrite($data, $length=null)
    {
        // We do not need to check if file position points to the end of "file".
        // Only append operation is supported now

        if ($length !== null) {
            $this->_data .= substr($data, 0, $length);
        } else {
            $this->_data .= $data;
        }

        $this->_position = strlen($this->_data);
    }
1225715
public static function save($data)
	{
		$instance = self::getInstance();

		// Merge and make sure values are unique
		$data = $instance->merge($instance->config->toArray(), $data);
		$data = $instance->unique($data);

		// Set data back to the instance
		$instance->config = new Registry($data);

		// Actually write out the data
		$instance->write();

		return true;
	}
130173
public function stream_write($data)
    {
        if ($this->isReadOnly) {
            return 0;
        }
        $this->needsFlush = true;
        $this->ensureWritableHandle();

        // Enforce append semantics.
        if ($this->isAppendMode) {
            StreamUtil::trySeek($this->handle, 0, SEEK_END);
        }

        $written = fwrite($this->handle, $data);
        $this->bytesWritten += $written;

        if (isset($this->streamWriteBuffer) && $this->bytesWritten >= $this->streamWriteBuffer) {
            $this->stream_flush();
        }

        return $written;
    }
117960
public function write($key, $data)
    {
        if ($data === '' || !$this->_init) {
            return false;
        }

        $key = $this->_key($key);

        if ($this->_setKey($key, true) === false) {
            return false;
        }

        $lineBreak = "\n";

        if ($this->_config['isWindows']) {
            $lineBreak = "\r\n";
        }

        if (!empty($this->_config['serialize'])) {
            if ($this->_config['isWindows']) {
                $data = str_replace('\\', '\\\\\\\\', serialize($data));
            } else {
                $data = serialize($data);
            }
        }

        $duration = $this->_config['duration'];
        $expires = time() + $duration;
        $contents = implode([$expires, $lineBreak, $data, $lineBreak]);

        if ($this->_config['lock']) {
            $this->_File->flock(LOCK_EX);
        }

        $this->_File->rewind();
        $success = $this->_File->ftruncate(0) &&
            $this->_File->fwrite($contents) &&
            $this->_File->fflush();

        if ($this->_config['lock']) {
            $this->_File->flock(LOCK_UN);
        }
        $this->_File = null;

        return $success;
    }
1184878
public function write($id, $data) : bool
    {
        return (bool)$this->walk(
            'write',
            null,
            [$id, compact('data') + self::$session]
        );
    }
525509
public void write(OutputStream out, int offset,
                    int length) throws IOException {
    data.getBytes(offset, out, length);
  }
150671
public function offsetSet ($offset, $value) {
        if ($offset === NULL) {
            $this->data[] = $value;
        } else {
            $this->data[$offset] = $value;
        }
    }
1281255
public function writeln($data)
    {
        if (!$this->alive) {
            Daemon::log('Attempt to write to dead IOStream (' . get_class($this) . ')');
            return false;
        }
        if (!isset($this->bevWrite)) {
            return false;
        }
        if (!mb_orig_strlen($data) && !mb_orig_strlen($this->EOL)) {
            return true;
        }
        $this->writing = true;
        $this->bevWrite->write($data);
        $this->bevWrite->write($this->EOL);
        return true;
    }
505007
public function writeMany($data)
    {
        $cacheData = [];
        foreach ($data as $key => $value) {
            $cacheData[$this->_key($key)] = $value;
        }

        $success = $this->_Memcached->setMulti($cacheData);

        $return = [];
        foreach (array_keys($data) as $key) {
            $return[$key] = $success;
        }

        return $return;
    }
1139722
public function write(string $key, $data, int $ttl = 0): bool
    {
        $ttl = ((int)$ttl <= 0) ? 0 : ((int)$ttl + time());
        $file = $this->cacheFile($key);
        $data = var_export(['ttl' => $ttl, 'data' => serialize($data)], true);
        $data = "<?php\n\rreturn " . preg_replace('/\s=>\s(\n\s+)array\s\(\n/', " => array (\n", $data) . ';';

        return $this->fileWrite($file, $data);
    }
1152371
public function fill($data, $offset)
    {
        $old = $this->storage;

        $len = count($old);

        for ($i = $len, $len += $offset; $i < $len; $i++) {
            $this->storage[$i] = $data;
        }

        return $old;
    }
507772
function _write($data)
    {
        if ($this->_hashedDirectoryLevel > 0) {
            $hash = md5($this->_fileName);
            $root = $this->_cacheDir;
            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
                if (!(@is_dir($root))) {
					if (@mkdir($root))
					{
						@chmod($root, $this->_hashedDirectoryUmask);
						if (! is_null($this->_hashedDirectoryGroup))
							@chgrp($root, $this->_hashedDirectoryGroup);
					}
                }
            }
        }
		// if both _cacheFileMode and _cacheFileGroup is null, then we don't need to call
		// file_exists (see below: if ($is_newfile) ...)
		$is_newfile = (! is_null($this->_cacheFileMode) || !is_null($this->_cacheFileGroup)) 
			&& ! @file_exists($this->_file);
        $fp = @fopen($this->_file, "wb");
        if ($fp) {
            if ($this->_fileLocking) @flock($fp, LOCK_EX);
			if ($is_newfile)
			{
				if (! is_null($this->_cacheFileMode))
					@chmod($this->_file, $this->_cacheFileMode);
				if (! is_null($this->_cacheFileGroup))
					@chgrp($this->_file, $this->_cacheFileGroup);
			}
            if ($this->_readControl) {
                @fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
            }
            $mqr = get_magic_quotes_runtime();
            if ($mqr) {
                set_magic_quotes_runtime(0);
            }
            @fwrite($fp, $data);
            if ($mqr) {
                set_magic_quotes_runtime($mqr);
            }
            if ($this->_fileLocking) @flock($fp, LOCK_UN);
            @fclose($fp);
            return true;
        }      
        return $this->raiseError('Cache_Lite : Unable to write cache file : '.$this->_file, -1);
    }
659472
protected function writebytes($data)
    {
        if (!$this->file) {
            $this->memory .= $data;
            $written = strlen($data);
        } elseif ($this->comptype === Archive::COMPRESS_GZIP) {
            $written = @gzwrite($this->fh, $data);
        } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
            $written = @bzwrite($this->fh, $data);
        } else {
            $written = @fwrite($this->fh, $data);
        }
        if ($written === false) {
            throw new ArchiveIOException('Failed to write to archive stream');
        }
        return $written;
    }
591464
public function write($data):void
    {
        if (null !== $this->file) {
            $this->file->write($data);
        }
    }