Esempio n. 1
0
 /**
  * Given the hash, this function will remove it from the cache.
  *
  * @param string $hash
  *  The user defined hash of the data
  * @param string $namespace
  *  Delete multiple items by a namespace
  * @return boolean
  */
 public function delete($hash = null, $namespace = null)
 {
     if ($this->cacheProvider instanceof iNamespacedCache) {
         return $this->cacheProvider->delete($hash, $namespace);
     }
     return $this->cacheProvider->delete($hash);
 }
Esempio n. 2
0
 public function del_cahce($cid = null)
 {
     if (empty($cid)) {
         return;
     }
     iCache::delete('iCMS/category/' . $cid);
 }
Esempio n. 3
0
 public static function cache()
 {
     $rs = iDB::all("SELECT `id`,`name`,`title`,`table`,`field` FROM `#iCMS@__app`");
     foreach ((array) $rs as $a) {
         $tb_array = json_decode($a['table']);
         $table = array('name' => '#iCMS@__' . $tb_array[0][0], 'primary' => $tb_array[0][1]);
         if ($tb_array[1]) {
             $table['join'] = '#iCMS@__' . $tb_array[1][0];
             $table['on'] = $tb_array[1][1];
         }
         $a['table'] = $table;
         $app_id_array[$a['id']] = $a;
         $app_name_array[$a['name']] = $a;
         iCache::delete('iCMS/app/' . $a['id']);
         iCache::set('iCMS/app/' . $a['id'], $a, 0);
         iCache::delete('iCMS/app/' . $a['name']);
         iCache::set('iCMS/app/' . $a['name'], $a, 0);
     }
     iCache::set('iCMS/app/cache_id', $app_id_array, 0);
     iCache::set('iCMS/app/cache_name', $app_name_array, 0);
 }
Esempio n. 4
0
 public static function del($tags, $field = 'name', $iid = 0)
 {
     $tagArray = explode(",", $tags);
     $iid && ($sql = "AND `iid`='{$iid}'");
     foreach ($tagArray as $k => $v) {
         $tagA = iDB::row("SELECT * FROM `#iCMS@__tags` WHERE `{$field}`='{$v}' LIMIT 1;");
         $tRS = iDB::all("SELECT `iid` FROM `#iCMS@__tags_map` WHERE `node`='{$tagA->id}' AND `appid`='" . TAG_APPID . "' {$sql}");
         foreach ((array) $tRS as $TL) {
             $idA[] = $TL['iid'];
         }
         // if($idA){
         // 	iPHP::appClass('model',"break");
         // 	$table	= model::table(TAG_APPID);
         // 	$ids	= implode(',',$idA);
         // 	iDB::query("UPDATE `#iCMS@__$table` SET `tags`=REPLACE(tags, '$tagA->name,',''),`tags`=REPLACE(tags, ',$tagA->name','') WHERE id IN($ids)");
         // }
         iDB::query("DELETE FROM `#iCMS@__tags`  WHERE `{$field}`='{$v}'");
         iDB::query("DELETE FROM `#iCMS@__tags_map` WHERE `node`='{$tagA->id}' AND `appid`='" . TAG_APPID . "' {$sql}");
         $ckey = self::tkey($tagA->cid);
         iCache::delete($ckey);
     }
 }
Esempio n. 5
0
 /**
  * Given the hash, this function will remove it from the cache.
  *
  * @param string $hash
  *  The user defined hash of the data
  * @return boolean
  */
 public function delete($hash = null)
 {
     return $this->cacheProvider->delete($hash);
 }
Esempio n. 6
0
 public static function del($tags, $field = 'name', $iid = 0)
 {
     $tagArray = explode(",", $tags);
     $iid && ($sql = "AND `iid`='{$iid}'");
     foreach ($tagArray as $k => $v) {
         $tag = iDB::row("SELECT * FROM `#iCMS@__tags` WHERE `{$field}`='{$v}' LIMIT 1;");
         $tRS = iDB::all("SELECT `iid` FROM `#iCMS@__tags_map` WHERE `node`='{$tag->id}' AND `appid`='" . TAG_APPID . "' {$sql}");
         foreach ((array) $tRS as $TL) {
             $idA[] = $TL['iid'];
         }
         if ($idA) {
             $ids = iPHP::get_ids($idA, null);
             if ($ids) {
                 iPHP::app('apps.class', 'static');
                 $table = APPS::table(TAG_APPID);
                 iDB::query("\n                        UPDATE `#iCMS@__{$table}`\n                        SET `tags`= REPLACE(tags, '{$tag->name},',''),\n                        `tags`= REPLACE(tags, ',{$tag->name}','')\n                        WHERE id IN({$ids})\n                    ");
             }
         }
         self::$remove && iDB::query("DELETE FROM `#iCMS@__tags`  WHERE `{$field}`='{$v}'");
         iDB::query("\n                DELETE FROM\n                `#iCMS@__tags_map`\n                WHERE `node`='{$tag->id}'\n                AND `appid`='" . TAG_APPID . "' {$sql}");
         $ckey = self::tkey($tag->cid);
         iCache::delete($ckey);
     }
 }