Beispiel #1
0
 public function __construct()
 {
     if (!function_exists('memcache_connect')) {
         throw new Exception("Memcache functions not available");
     }
     $this->host = Config::get('ioMemCacheCache_host');
     $this->port = Config::get('ioMemCacheCache_port');
     if (empty($this->host) || empty($this->port)) {
         throw new Exception("You need to supply a valid memcache host and port");
     }
 }
Beispiel #2
0
 public function execute()
 {
     $body = '';
     /** @var HttpRequest $req */
     foreach ($this->requests as $key => $req) {
         $body .= "--{$this->boundary}\n";
         $body .= $req->toBatchString($key) . "\n";
     }
     $body = rtrim($body);
     $body .= "\n--{$this->boundary}--";
     $url = Config::get('basePath') . '/batch';
     $httpRequest = new HttpRequest($url, 'POST');
     $httpRequest->setRequestHeaders(array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary));
     $httpRequest->setPostBody($body);
     $response = Client::$io->makeRequest($httpRequest);
     $response = $this->parseResponse($response);
     return $response;
 }
Beispiel #3
0
 public function __construct()
 {
     if (Config::has('developer_key')) {
         $this->setDeveloperKey(Config::get('developer_key'));
     }
 }
Beispiel #4
0
 public function __construct()
 {
     $this->path = Config::get('ioFileCache_directory');
 }
Beispiel #5
0
 protected function useObjects()
 {
     return Config::get('use_objects', false);
 }
Beispiel #6
0
 /**
  * @param string $url the url to set
  */
 public function setUrl($url)
 {
     if (substr($url, 0, 4) == 'http') {
         $this->url = $url;
     } else {
         $this->url = Config::get('basePath') . $url;
     }
 }