Example #1
0
 /**
  *	Adds or updates a data pair.
  *	@access		public
  *	@param		string		$key		Data pair key
  *	@param		string		$value		Data pair value
  *	@param		integer		$expiration	Data life time in seconds or expiration timestamp
  *	@return		void
  */
 public function set($key, $value, $expiration = NULL)
 {
     $this->data[$key] = $value;
     $list = array();
     foreach ($this->data as $key => $value) {
         $list[] = $key . '=' . serialize($value);
     }
     \FS_File_Writer::save($this->resource, join("\n", $list));
 }
Example #2
0
 /**
  *	Adds or updates a data pair.
  *	@access		public
  *	@param		string		$key		Data pair key
  *	@param		string		$value		Data pair value
  *	@param		integer		$expiration	Data life time in seconds or expiration timestamp
  *	@return		boolean		Result state of operation
  */
 public function set($key, $value, $expiration = NULL)
 {
     if (is_object($value) || is_resource($value)) {
         throw new \InvalidArgumentException('Value must not be an object or resource');
     }
     $uri = $this->path . $this->context . $key;
     if (dirname($key) != '.') {
         $this->createFolder(dirname($key));
     }
     return (bool) \FS_File_Writer::save($uri, $value);
 }
Example #3
0
 /**
  *	Adds or updates a data pair.
  *	@access		public
  *	@param		string		$key		Data pair key
  *	@param		string		$value		Data pair value
  *	@param		integer		$expiration	Data life time in seconds or expiration timestamp
  *	@return		void
  */
 public function set($key, $value, $expiration = NULL)
 {
     $uri = $this->getUriForKey($key);
     $this->data[$key] = $value;
     \FS_File_Writer::save($uri, serialize($value));
 }
Example #4
0
 /**
  *	Adds or updates a data pair.
  *	@access		public
  *	@param		string		$key		Data pair key
  *	@param		string		$value		Data pair value
  *	@param		integer		$expiration	Data life time in seconds or expiration timestamp
  *	@return		void
  */
 public function set($key, $value, $expiration = NULL)
 {
     $tmpFile = tempnam('./', 'ftp_' . uniqid() . '_');
     \FS_File_Writer::save($tmpFile, $value);
     $this->client->putFile($tmpFile, $this->context . $key);
     @unlink($tmpFile);
 }