当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::delete方法代码示例

本文整理汇总了PHP中Cache::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::delete方法的具体用法?PHP Cache::delete怎么用?PHP Cache::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cache的用法示例。


在下文中一共展示了Cache::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 /**
  * Internal cleaning process.
  *
  * @param boolean $cleanAll
  *
  * @return void
  */
 protected function process($cleanAll = true)
 {
     $key = dba_firstkey($this->cache->getDba());
     while ($key !== false && $key !== null) {
         if (true === $cleanAll) {
             $this->cache->delete($key);
         } else {
             $this->cache->get($key);
         }
         $key = dba_nextkey($this->cache->getDba());
     }
     dba_optimize($this->cache->getDba());
 }
开发者ID:gjerokrsteski,项目名称:php-dba-cache,代码行数:20,代码来源:Sweep.php

示例2: move

 /**
  * changes ordering of items
  *
  * @param int    $id        - id of moved element
  * @param string $direction - up, down
  */
 function move($id, $direction = '')
 {
     $this->Access->checkAccess('slides', 'u');
     $error = false;
     if (empty($id) || !in_array($direction, array('up', 'down'))) {
         $error = true;
     }
     $currentItem = $this->Slide->read(null, $id);
     $currentOrderId = $currentItem['Slide']['ordering'];
     if ($direction == 'up') {
         $newItem = $this->Slide->find('first', array('conditions' => array('ordering <' => $currentOrderId), 'order' => 'ordering DESC'));
     }
     if ($direction == 'down') {
         $newItem = $this->Slide->find('first', array('conditions' => array('ordering >' => $currentOrderId), 'order' => 'ordering ASC'));
     }
     if (empty($currentItem) || empty($newItem)) {
         $error = true;
     }
     $newOrderId = $newItem['Slide']['ordering'];
     $currentItem['Slide']['ordering'] = $newOrderId;
     $newItem['Slide']['ordering'] = $currentOrderId;
     if (!$this->Slide->save($currentItem) || !$this->Slide->save($newItem)) {
         Cache::delete('slides');
         $error = true;
     } else {
         Cache::delete('slides');
     }
     if (!$error) {
         $this->Session->setFlash(__('The ordering has been changed'), 'flash_success');
         $this->redirect(array('action' => 'index'));
     } else {
         $this->Session->setFlash(__('The ordering could not be changed. Please, try again.'), 'flash_error');
         $this->redirect(array('action' => 'index'));
     }
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:41,代码来源:SlidesController.php

示例3: testDeleteCallsRedisDeleteMethod

 public function testDeleteCallsRedisDeleteMethod()
 {
     $redis = $this->getMockBuilder('\\Redis')->getMock();
     $redis->expects($this->once())->method('delete')->with('prefix:key')->willReturn(true);
     $cache = new Cache($redis, 'prefix');
     $this->assertTrue($cache->delete('key'));
 }
开发者ID:vicgarcia,项目名称:kaavii,代码行数:7,代码来源:CacheTest.php

示例4: admin_edit

 /**
  * 编辑某个页面的文案
  *
  * @access public
  * @return void
  */
 public function admin_edit($name)
 {
     $miscs = Configure::read('misc');
     if (!isset($miscs[$name])) {
         throw new NotFoundException(__('Invalid misc post'));
     }
     $post = $this->MiscPost->getPost($miscs[$name]['title']);
     if (empty($post)) {
         $this->_init_posts($miscs);
         $post = $this->MiscPost->getPost($miscs[$name]['title']);
     }
     if ($this->request->is('post') || $this->request->is('put')) {
         if ($this->MiscPost->save($this->request->data, false)) {
             $this->Session->setFlash(__('The content has been saved'), 'success');
             $post = $this->MiscPost->getPost($miscs[$name]['title']);
             Cache::delete('articles', 'short');
             Cache::delete('articles_mobile', 'short');
         } else {
             $this->Session->setFlash(__('The content could not be saved. Please, try again.'), 'error');
         }
     } else {
         $this->request->data = $post;
     }
     $this->set('post', $post);
 }
开发者ID:wangshipeng,项目名称:license,代码行数:31,代码来源:MiscPostsController.php

示例5: validate

 public function validate(Validation $array, $save = FALSE)
 {
     // uses PHP trim() to remove whitespace from beginning and end of all fields before validation
     $array->pre_filter('trim');
     // merge unvalidated fields, in case the subclass has set any.
     if (!isset($this->unvalidatedFields)) {
         $this->unvalidatedFields = array();
     }
     $this->unvalidatedFields = array_merge($this->unvalidatedFields, array('validation_rules', 'public', 'multi_value', 'deleted'));
     $array->add_rules('caption', 'required');
     $array->add_rules('data_type', 'required');
     if (array_key_exists('data_type', $array->as_array()) && $array['data_type'] == 'L') {
         if (empty($array['termlist_id'])) {
             $array->add_rules('termlist_id', 'required');
         } else {
             array_push($this->unvalidatedFields, 'termlist_id');
         }
     }
     $array->add_rules('system_function', 'length[1,30]');
     $parent_valid = parent::validate($array, $save);
     // clean up cached required fields in case validation rules have changed
     $cache = Cache::instance();
     $cache->delete_tag('required-fields');
     if ($save && $parent_valid) {
         // clear the cache used for attribute datatype and validation rules since the attribute has changed
         $cache = new Cache();
         // Type is the object name with _attribute stripped from the end
         $type = substr($this->object_name, 0, strlen($this->object_name) - 10);
         $cache->delete('attrInfo_' . $type . '_' . $this->id);
     }
     return $save && $parent_valid;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:32,代码来源:ATTR_ORM.php

示例6: delete

 function delete($key)
 {
     parent::delete($key);
     $key = SITE_NAME . "|{$key}";
     $varkey = $this->_hash_key($key);
     return @shm_remove_var($this->shmid, $varkey);
 }
开发者ID:jvinet,项目名称:pronto,代码行数:7,代码来源:shm.php

示例7: delete

 function delete($key)
 {
     // Delete from static cache
     parent::delete($this->key($key));
     // Remove from memcache.
     return $this->memcache->delete($this->key($key));
 }
开发者ID:nabuur,项目名称:nabuur-d5,代码行数:7,代码来源:memcache.php

示例8: voting

 /**
  * Vote
  * @author vovich
  * @param unknown_type $model
  * @param unknown_type $modelId
  * @param unknown_type $point
  * @return JSON
  */
 function voting($model, $modelId, $delta)
 {
     Configure::write('debug', 0);
     $this->layout = false;
     $result = array("error" => "", "sum" => 0, "votes_plus" => 0, "votes_minus" => 0);
     $userId = $this->Access->getLoggedUserID();
     if (!$this->RequestHandler->isAjax()) {
         $this->redirect($_SERVER['HTTP_REFERER']);
     }
     if ($userId == VISITOR_USER || !$userId) {
         $result['error'] = "Access error, please login.";
     } elseif (!$this->Access->getAccess('Vote_' . $model, 'c')) {
         $result['error'] = "You can not vote for this " . $model . "<BR> please logg in ";
     } else {
         $result['error'] = $this->Vote->canVote($model, $modelId, $userId);
     }
     $data['model'] = Sanitize::paranoid($model);
     $data['model_id'] = Sanitize::paranoid($modelId);
     $data['user_id'] = $userId;
     $data['delta'] = $delta;
     if (Sanitize::paranoid($model) == 'Image') {
         Cache::delete('last_images');
     } elseif (Sanitize::paranoid($model) == 'Video') {
         Cache::delete('last_images');
     }
     if (empty($result['error'])) {
         $points = $this->Vote->add($data);
         $result['votes_plus'] = $points['votes_plus'];
         $result['votes_minus'] = $points['votes_minus'];
         $result['sum'] = $points['votes_plus'] - $points['votes_minus'];
     }
     exit($this->Json->encode($result));
 }
开发者ID:sgh1986915,项目名称:cakephp2-bpong,代码行数:41,代码来源:VotesController.php

示例9: do_task

 /**
  * 执行清空缓存
  * @return void
  */
 public function do_task()
 {
     if (!empty($this->task_data)) {
         $user_id = $this->task_data['user_id'];
         $added_ids = $this->task_data['added_ids'];
         $updated_ids = $this->task_data['updated_ids'];
         $deleted_ids = $this->task_data['deleted_ids'];
         $recycled_ids = $this->task_data['recycled_ids'];
         $ids = array_merge($added_ids, $updated_ids, $deleted_ids);
         if ($updated_ids or $recycled_ids or $deleted_ids) {
             $this->update_cache($user_id, 'recycled_list_update');
         }
         if (!empty($ids) or $this->is_snapshot) {
             Category_Model::instance()->clear_cache($user_id);
         }
         if (!empty($ids)) {
             foreach ($ids as $id) {
                 $this->cache->delete($this->cache_pre . 'find_by_id_' . $user_id . '_' . $id);
             }
             $this->cache->delete($this->cache_pre . 'get_list_' . $user_id);
             $this->cache->delete($this->cache_pre . 'get_count_' . $user_id);
             Friend_Model::instance()->del_user_link_cache($user_id);
         }
     }
 }
开发者ID:momoim,项目名称:momo-api,代码行数:29,代码来源:contact.php

示例10: delete

 public function delete($guid = null)
 {
     $cache = new Cache('note');
     $cache->delete($this->note->guid);
     $this->note = new Note();
     return self::_noteStore()->deleteNote(AUTH_TOKEN, $guid ?: $this->guid);
 }
开发者ID:ryunhe,项目名称:everidea,代码行数:7,代码来源:idea.php

示例11: destroy

 public function destroy($id)
 {
     if (!empty($this->cacheKey)) {
         Cache::delete($id, $this->cacheKey);
     }
     return parent::destroy($id);
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:7,代码来源:ComboSession.php

示例12: editUser

	function editUser($parameters, $user_id=null){
	if($user_id==$parameters->{'id'}){

	      $user['User']['id']=$parameters->{'id'};
	      if(($parameters->{'username'})){
	      $user['User']['username']=$parameters->{'username'};
	      }
	      if(($parameters->{'status'})){
	      $user['User']['status']=$parameters->{'status'};
	      }
	      if(($parameters->{'fullname'})){
	      $user['User']['fullname']=$parameters->{'fullname'};
	      }
	      if(($parameters->{'email'})){
	      $user['User']['email']=$parameters->{'email'};
	      }
	      $this->primaryKey='id';
	      if($this->save($user['User'])){
 		$ck = 'viewgetuser_'.$user_id;
		Cache::delete($ck,'userauth');
		$user=$this->getUser($user_id);
		return $user;
	      } else {
                return false;
	      }
            } else {
	      return false;
	    }
	}
开发者ID:nard,项目名称:Pushchat-Server,代码行数:29,代码来源:user.php

示例13: _clearCache

 protected function _clearCache($type = null)
 {
     foreach (Cache::read($this->cachePrefix()) as $key => $value) {
         Cache::delete($key);
     }
     return parent::_clearCache();
 }
开发者ID:nnanna217,项目名称:Mastering-CakePHP,代码行数:7,代码来源:AppModel.php

示例14: delete

 function delete($key)
 {
     parent::delete($key);
     $key = $this->_mangle_key($key);
     $fn = $this->cache_dir . DS . $key;
     return is_file($fn) ? @unlink($fn) : false;
 }
开发者ID:jvinet,项目名称:pronto,代码行数:7,代码来源:file.php

示例15: afterDelete

 public function afterDelete()
 {
     parent::afterDelete();
     if ($this->id) {
         Cache::delete('getPracticeTitleById' . $this->id);
     }
 }
开发者ID:aichelman,项目名称:StudyUp,代码行数:7,代码来源:PracticeTest.php


注:本文中的Cache::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。