예제 #1
0
파일: IniFile.php 프로젝트: CeusMedia/Cache
 /**
  *	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));
 }
예제 #2
0
파일: Folder.php 프로젝트: CeusMedia/Cache
 /**
  *	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);
 }
예제 #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));
 }
예제 #4
0
파일: FTP.php 프로젝트: CeusMedia/Cache
 /**
  *	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);
 }