Example #1
0
 public static function post($url, $params = array())
 {
     $curl = new self($url, CURLOPT_POST, $params);
     $resp = $curl->request();
     $curl->disconnect();
     return $resp;
 }
Example #2
0
 public static function get($url)
 {
     $curl = new self($url, CURLOPT_HTTPGET);
     $resp = $curl->request();
     $curl->disconnect();
     return $resp;
 }
Example #3
0
 public static function Dispose($cache_name, $options = array())
 {
     unset($options["save_on_destruction"]);
     $mc = new self($cache_name, $options);
     if (!$mc->is_dirty()) {
         return;
     }
     $mc->connect();
     if (!($res = $mc->mem_cache_instace->replace($mc->genKey(), $mc->get_internal_cache()))) {
         $res = $mc->mem_cache_instace->set($mc->genKey(), $mc->get_internal_cache());
     }
     if ($mc->mem_cache_instace->get($mc->genKey()) != $mc->get_internal_cache()) {
         $mc->disconnect();
         throw new \Exception("It seems race condition happened on saving cache updates, updates not saved!");
     }
     $mc->disconnect();
 }