Example #1
0
 /**
  *	Returns a data pair value by its key or NULL if pair not found.
  *	@access		public
  *	@param		string		$key		Data pair key
  *	@return		mixed
  */
 public function get($key)
 {
     if (!$this->has($key)) {
         return NULL;
     }
     $tmpFile = tempnam('./', 'ftp_' . uniqid() . '_');
     $this->client->getFile($this->context . $key, $tmpFile);
     $content = \FS_File_Reader::load($tmpFile);
     @unlink($tmpFile);
     return $content;
 }
Example #2
0
 public function __construct($resource = NULL, $context = NULL, $expiration = NULL)
 {
     $this->resource = $resource;
     if (!file_exists($resource)) {
         touch($resource);
     }
     $list = trim(\FS_File_Reader::load($resource));
     if ($list) {
         foreach (explode("\n", $list) as $line) {
             $parts = explode('=', $line, 2);
             $this->data[$parts[0]] = unserialize($parts[1]);
         }
     }
 }