コード例 #1
0
ファイル: SorguKisitlama.class.php プロジェクト: QRMarket/PHP
 /**
  * sorgu kısıtlaması yapmak istiyorsanız her sorgunun sonunda bu method çağrılır
  *
  * @param integer $maxSorgu
  * @param integer $timeout
  * @return void
  */
 public function set($maxSorgu, $timeout, $ip = null)
 {
     $cacheArr = $this->getCache($ip);
     # daha önce sorgulama yapıldı
     if (is_array($cacheArr)) {
         $index = $cacheArr['index'];
         $cacheArr = ['index' => ++$index, 'maxSorgu' => $maxSorgu];
         self::$CACHE->replace($this->getCacheId($ip), $cacheArr, $timeout);
     } else {
         $cacheArr = ['index' => 1, 'maxSorgu' => $maxSorgu];
         self::$CACHE->setCache($this->getCacheId($ip), $cacheArr, $timeout);
     }
 }