コード例 #1
0
ファイル: test.php プロジェクト: lughong/test
 public function cache()
 {
     var_dump(Cache::get('name'));
     var_dump(Cache::set('news', 'sumshine'));
     var_dump(Cache::get('news'));
     var_dump(Cache::del('news'));
     var_dump(Cache::get('news'));
 }
コード例 #2
0
ファイル: api.test.php プロジェクト: baki250/angular-io-app
 /**
  * cache test call
  *
  * @param string $input
  * @return bool
  *
  * @url GET cache
  * @access public
  */
 function testCache($input = '')
 {
     $redis = new Cache('test', 'redis', array());
     $r[] = $redis->get('key');
     $r[] = $redis->set('key', 'value');
     $r[] = $redis->get('key');
     $r[] = $redis->del('key');
     return $r;
 }
コード例 #3
0
ファイル: Safe.php プロジェクト: derek-chow/YunYinService
 public static function del($key)
 {
     Cache::del('s_t_' . $key);
 }
コード例 #4
0
ファイル: App.class.php プロジェクト: DenonHuang/xbphp
 /**
  * debug方法
  * @author wave
  */
 protected static function debug()
 {
     $sqlArr = Cache::read('sql');
     $time = Cache::read('time');
     Cache::del('sql');
     require ROOT . DS . ROOT_PATH . DS . ROOT_ERROR . DS . 'tpl' . DS . 'iframe.tpl';
 }
コード例 #5
0
ファイル: PhotoM.class.php プロジェクト: lughong/test
 protected static function _publicUpload($file_type = null, $name = null, $file_name = null, $dir_id = null, $is_mobile = 0, $uid)
 {
     global $upload_config;
     $type_id = null;
     foreach ($upload_config as $key => $value) {
         if (strstr($value, strtolower($file_type))) {
             $type_id = $key;
             break;
         }
     }
     //判断文件是否已存在
     // if( function_exists( 'com_create_guid' ) ){
     // 	$upload_path = com_create_guid();//函数com_create_guid在linux centos6.5不支持,可能没配置
     // }else{
     // 	$upload_path = md5( $path . $file_name );
     // }
     $path = ROOT_PATH . PhotoM::uploadPath . $uid . '/' . $type_id . '/' . $dir_id . '/';
     $upload_path = md5($path . $file_name . $file_type . time());
     $save = $path . $upload_path . '.' . $file_type;
     if ($type_id && !is_file($path . $upload_path . '.' . $file_type)) {
         //目录不存在,创建目录
         if (!is_dir($path)) {
             mkdir($path, 0755, true);
         }
         if (!move_uploaded_file($name, $save)) {
             throw new Exception('exit');
         }
         $data['uid'] = $uid;
         $data['dir_id'] = $dir_id;
         $data['type_id'] = $type_id;
         $data['file_name'] = $file_name;
         $data['file_type'] = $file_type;
         $data['upload_path'] = $uid . '/' . $type_id . '/' . $dir_id . '/' . $upload_path . '.' . $file_type;
         $results_upload = UploadFile::addUploadFile($data);
         //缓存上传的图片(缩放后的图片)
         $cache_dir = '/temp/photo/' . $data['uid'] . '/' . $data['type_id'] . '/' . $data['dir_id'] . '/';
         PhotoM::_cachePhoto($cache_dir, $data['upload_path'], $file_type);
         //删除redis缓存的数据
         $key_footer = 'uploadFileListByDir_' . $uid . '_' . $dir_id;
         Cache::del($key_footer);
         if ($is_mobile) {
             return true;
         } else {
             $data1['id'] = $results_upload;
             return $data1;
         }
     }
 }
コード例 #6
0
ファイル: LuS.class.php プロジェクト: lughong/test
 protected function _delRedisSession()
 {
     //使用redis缓存数据
     $key = session_id();
     return Cache::del($key);
 }
コード例 #7
0
if (!Is::app('PHPfox_FeaturedUsers')) {
    return false;
}
new Payment\Event('featured-users', function (\Core\Payment\Object $payment) {
    $payment->log('Event touchdown...');
    if ($payment->success()) {
        $payment->log('Setting user "' . $payment->item_number . '" to be featured.');
        $db = new Db();
        $cache = new Cache();
        try {
            $user = (new \Api\User())->get($payment->item_number);
            $total = (int) $db->select('*')->from(':user_featured')->count();
            $total++;
            $db->delete(':user_featured', ['user_id' => $user->id]);
            $db->insert(':user_featured', ['user_id' => $user->id, 'ordering' => $total]);
            $cache->del('featured_users');
        } catch (\Exception $e) {
            $payment->log($e->getMessage());
        }
    }
});
new Route('/featured-users/thanks', function (Controller $controller) {
    return $controller->render('thanks.html');
});
new Route('/featured-users/pay', function (Controller $controller) {
    $auth = new Auth\User();
    $auth->membersOnly();
    $controller->h1(_p('Get Featured'), '');
    return $controller->render('pay.html');
});
コード例 #8
0
ファイル: WxSDK.php プロジェクト: shaovie/php
 /**
  * 主动删除token信息
  * 通常在token失效的时候使用
  */
 public static function delAccessToken()
 {
     Cache::del(Cache::CK_WX_ACCESS_TOKEN . WX_APP_ID);
     Log::warng('weixin - user del access token!');
 }
コード例 #9
0
ファイル: UserDetailModel.php プロジェクト: noikiy/php
 private static function onUpdateData($userId)
 {
     Cache::del(Cache::CK_USER_DETAIL_INFO . $userId);
     self::findUserDetailById($userId, 'w');
 }
コード例 #10
0
ファイル: File.php プロジェクト: derek-chow/YunYinService
 /**
  * 删除上传token,放弃上传
  * DELETE /file/token/tmp_ae1233
  * @method POST_token
  * @param name 文件名
  */
 public function DELETE_tokenAction($key = null)
 {
     if ($key && ($name = Cache::get($key))) {
         list(, $userid) = explode('_', $key, 3);
         $userid = $this->auth($userid);
         Cache::del($key);
         $bucket = Config::getSecret('qiniu', 'file');
         File::del($bucket . ':' . $key);
         $this->response(1, '已经成功删除' . $name);
     } else {
         $this->response(0, '此上传信息不存在');
     }
 }
コード例 #11
0
ファイル: WxUserModel.php プロジェクト: noikiy/php
 private static function onUpdateData($openid)
 {
     Cache::del(Cache::CK_WX_USER_INFO . $openid);
     $data = self::findUserByOpenId($openid, 'w');
     if (!empty($data['user_id'])) {
         Cache::del(Cache::CK_WX_USER_INFO_FOR_UID . $data['user_id']);
         self::findUserByUserId($data['user_id'], 'w');
     }
 }
コード例 #12
0
ファイル: photo.php プロジェクト: lughong/test
 public function del($act)
 {
     $file_arr = explode('_', $act);
     if (!isset($file_arr[1]) || !isset($file_arr[2])) {
         $msg['msg'] = '失败';
         $msg['error'] = 1;
         echo json_encode($msg);
         throw new Exception('exit');
     }
     $uid = User::getLoginUid();
     $dir_id = $file_arr[1];
     $file_id = $file_arr[2];
     $results_sel_file_info = UploadFile::getUploadFileById($dir_id, $file_id, $uid);
     //删除文件
     if ($results_sel_file_info) {
         //删除文件
         PhotoM::delPhoto($results_sel_file_info);
         //删除redis缓存的数据
         $key_footer = 'uploadFileListByDir_' . $uid . '_' . $dir_id;
         Cache::del($key_footer);
         //删除数据库数据
         $results_del_file = UploadFile::deleteUploadFileById($dir_id, $file_id, $uid);
         if ($results_del_file) {
             $msg['msg'] = '成功';
             $msg['error'] = 0;
         } else {
             $msg['msg'] = '失败';
             $msg['error'] = 1;
         }
     } else {
         $msg['msg'] = '失败';
         $msg['error'] = 1;
     }
     echo json_encode($msg);
     throw new Exception('exit');
 }