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


PHP memcache_delete函数代码示例

本文整理汇总了PHP中memcache_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP memcache_delete函数的具体用法?PHP memcache_delete怎么用?PHP memcache_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: pdb_get_data

function pdb_get_data($key, $provider, $arguments = [])
{
    $mc_handler = memcache_pconnect(MC_HOST);
    $value = memcache_get($mc_handler, $key);
    if ($value !== false) {
        return $value;
    } else {
        $locking_key = 'lock_' . $key;
        $locking_value = microtime(true);
        for ($i = 0; $i < MC_LOCK_DELAY * 1000 / MC_SLEEP_TIME + 1; $i++) {
            $lock = memcache_add($mc_handler, $locking_key, $locking_value, 0, MC_LOCK_DELAY);
            if ($lock) {
                $value = call_user_func_array($provider, $arguments);
                memcache_set($mc_handler, $key, $value);
                memcache_delete($mc_handler, $locking_key);
                return $value;
            } else {
                usleep(MC_SLEEP_TIME);
                $value = memcache_get($mc_handler, $key);
                if ($value != false) {
                    return $value;
                }
            }
        }
    }
    return call_user_func_array($provider, $arguments);
}
开发者ID:plFlok,项目名称:vk_test_task,代码行数:27,代码来源:db_cache_proxy.php

示例2: cache_delete

function cache_delete($key, $timeout = 0)
{
    $connection = cache_connect();
    $res = memcache_delete($connection, (string) $key, (int) $timeout);
    memcache_close($connection);
    return $res;
}
开发者ID:smarty-kiki,项目名称:frame,代码行数:7,代码来源:cache.php

示例3: delete

 public function delete($name)
 {
     if (!is_resource($this->memcache)) {
         throw new \Exception("Memcached can't connect.");
     }
     return memcache_delete($this->memcache, $name);
 }
开发者ID:glzaboy,项目名称:fastlib,代码行数:7,代码来源:sae.php

示例4: cache_delete

function cache_delete($key)
{
    if (!cache_connect()) {
        return false;
    }
    return memcache_delete(object('memcache'), $GLOBALS['config']['service']['server'] . '/' . $key);
}
开发者ID:hcopr,项目名称:Hubbub,代码行数:7,代码来源:genlib.php

示例5: delItem

 public function delItem($key)
 {
     if (empty($key)) {
         throw new CacheException('CACHE ERROR:key is empty');
     }
     return memcache_delete($this->cache, $key);
 }
开发者ID:tiger2soft,项目名称:LycPHP,代码行数:7,代码来源:Memcache.class.php

示例6: process_request

function process_request()
{
    $item_id = isset($_POST['item_id']) ? intval($_POST['item_id']) : null;
    $item_name = isset($_POST['item_name']) ? $_POST['item_name'] : null;
    $item_price = isset($_POST['item_price']) ? $_POST['item_price'] : null;
    $item_description = isset($_POST['item_description']) ? $_POST['item_description'] : null;
    $item_img = isset($_POST['item_img']) ? $_POST['item_img'] : null;
    if (is_null($item_id) || $item_id <= 0) {
        die;
    }
    if (!is_null($item_name)) {
        $item_name = htmlspecialchars(trim($item_name));
        if ($item_name === '') {
            die;
        }
    }
    if (!is_null($item_price)) {
        if (!preg_match("/^\\d+([.,]\\d{1,2})?\$/", $item_price)) {
            die;
        }
    }
    if (!is_null($item_description)) {
        $item_description = htmlspecialchars(trim($item_description));
    }
    $item = db_get_item($item_id);
    if (!$item) {
        die;
    }
    $values = [];
    if (!is_null($item_name)) {
        $values['name'] = $item_name;
    }
    if (!is_null($item_price)) {
        $item_price = str_replace(',', '.', $item_price);
        $values['price'] = $item_price;
    }
    if (!is_null($item_description)) {
        $values['description'] = $item_description;
    }
    if (!is_null($item_img)) {
        $values['imgurl'] = $item_img;
    }
    if (!empty($values)) {
        db_update_item($item_id, $values);
        $mc_handler = memcache_connect('localhost');
        memcache_delete($mc_handler, get_page_cache_key($item_id));
        $min_price = min($item_price, $item['price']);
        pagination_rebuild_ids($mc_handler, $item_id, 1);
        if ($item_price == $item['price']) {
            $edited_pages_amount = 1;
        } else {
            $edited_pages_amount = 0;
        }
        pagination_rebuild_prices($mc_handler, $min_price, $edited_pages_amount);
        pagination_rebuild_prices($mc_handler, $min_price);
    }
    header('Location: /view_item.php?id=' . $item_id);
}
开发者ID:plFlok,项目名称:vk_test_task,代码行数:58,代码来源:edit_item_tech.php

示例7: memcache_version_del

function memcache_version_del($memcache_obj, $key)
{
    global $config;
    if ($config['mcache']['version'] == 0) {
        return memcache_delete($memcache_obj, $key);
    } else {
        return $memcache_obj->delete($key);
    }
}
开发者ID:laiello,项目名称:po-php-fwlite,代码行数:9,代码来源:memcache.func.php

示例8: register_static_delete

 static function register_static_delete($key)
 {
     $mmc = memcache_init();
     if ($mmc == false) {
         echo "那个坑爹的Memcache加载失败啦!笨蛋!\n";
     } else {
         memcache_delete($mmc, $key);
         return 1;
     }
 }
开发者ID:acsiiii,项目名称:leeeframework,代码行数:10,代码来源:data_use.php

示例9: SaeMemcacheDelete

function SaeMemcacheDelete($key)
{
    //如果长度超出,则取末尾的234位
    if (strlen($key) > 234) {
        $key = substr($key, -234);
    }
    $mmc = memcache_init();
    if ($mmc == false) {
        return false;
    } else {
        return memcache_delete($mmc, $key);
    }
}
开发者ID:ribunkou,项目名称:MyPHP,代码行数:13,代码来源:SaeMemcache.php

示例10: delete_search_keys

 function delete_search_keys()
 {
     $dbh = new PDO('mysql:dbname=' . AppConfig::gacv("AC_db") . ';host=' . AppConfig::gacv("AC_server"), AppConfig::gacv("AC_user"), AppConfig::gacv("AC_pass"));
     $memcache_obj = memcache_pconnect('localhost', 11211);
     $sql = sprintf("select search_key from %s ", "memcache_search_keys");
     $sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY));
     //
     $sth->execute();
     $res = $sth->fetchAll(PDO::FETCH_BOTH);
     //echo $sql.$this->lookup_tbl_id_col;//
     foreach ($res as $ar) {
         memcache_delete($memcache_obj, $ar["search_key"], 0);
     }
     /* Delete all rows from the FRUIT table */
     $count = $dbh->exec("DELETE FROM memcache_search_keys");
 }
开发者ID:awgtek,项目名称:myedb,代码行数:16,代码来源:memcache_search_key.php

示例11: del

 public function del($key)
 {
     if (FALSE == $this->mc) {
         if (FALSE == $this->connect()) {
             return FALSE;
         }
     }
     $key = $this->keys_prefix . $key;
     if ($this->debug_mode) {
         $time = microtime(TRUE);
         $res = memcache_delete($this->mc, $key);
         $time = microtime(TRUE) - $time;
         $this->debug_info->time += $time;
         $this->debug_info->queries[] = (object) array('action' => 'DELETE', 'key' => $key, 'result' => $res ? 'TRUE' : 'FALSE', 'time' => number_format($time, 5, '.', ''));
         return $res;
     }
     return memcache_delete($this->mc, $key);
 }
开发者ID:essa,项目名称:sharetronix_ja,代码行数:18,代码来源:class_cache_memcached.php

示例12: delete

 public static function delete($key, $name = 'default')
 {
     if (!App::instance()->get('cache_enable')) {
         return TRUE;
     }
     $client = self::client($key, $name);
     $ndx = self::$prefix . '_' . $key;
     switch (self::$engine) {
         case 'apc':
             return apc_delete($ndx);
         case 'redis':
             return $client->del($ndx);
             break;
         case 'memcache':
             return memcache_delete($client, $ndx);
             break;
         default:
             return @unlink($client . DS . $ndx);
     }
     return TRUE;
 }
开发者ID:willsky,项目名称:quick,代码行数:21,代码来源:cache.php

示例13: process_request

function process_request()
{
    $item_id = isset($_GET['item_id']) ? intval($_GET['item_id']) : false;
    if ($item_id == false || $item_id <= 0) {
        api_wrong_args();
        return;
    }
    $item = db_get_item($item_id);
    if (!$item) {
        api_echo_as_json("Item not found", 'msg');
        return;
    }
    db_delete_item($item_id);
    $mc_handler = memcache_connect('localhost');
    pagination_rebuild_ids($mc_handler, $item['id']);
    pagination_rebuild_prices($mc_handler, $item['price']);
    if (memcache_get($mc_handler, 'total_rows') !== false) {
        memcache_decrement($mc_handler, 'total_rows');
    }
    api_echo_as_json('Item deleted', 'msg');
    memcache_delete($mc_handler, "item_" . $item_id);
}
开发者ID:plFlok,项目名称:vk_test_task,代码行数:22,代码来源:delete.php

示例14: header

<?php

header("Content-Type:text/html;charset=utf-8");
require_once 'Mysql.class.php';
/**
 * 要删除的用户
 */
$openid = "osvGYs3ntLy0YDpOxfLK-Duj3r50";
$sqlStr1 = "delete from tb_studentInfo where openid='{$openid}'";
//删除学生信息表
$sqlStr2 = "delete from tb_studentScore where openid='{$openid}'";
//删除学生成绩表
$sqlStr3 = "delete from tb_studentSyllabus where openid='{$openid}'";
//删除学生课表
$mmc = memcache_init();
$class_mysqlObj = new Class_mysql();
if ($class_mysqlObj->query($sqlStr1) && $class_mysqlObj->query($sqlStr2) && $class_mysqlObj->query($sqlStr3)) {
    if (memcache_delete($mmc, $openid . "password") && memcache_delete($mmc, $openid . "zjh")) {
        echo "该学生删除成功";
    } else {
        echo "删除缓存失败";
    }
} else {
    echo "删除数据库信息失败";
}
开发者ID:mesfreeman,项目名称:ifreeweixin,代码行数:25,代码来源:deleteUser.php

示例15: memCacheDelete

 public function memCacheDelete($key)
 {
     $key = $this->mckeyPre . $key;
     return memcache_delete($this->mc, $key);
 }
开发者ID:web5,项目名称:LX_Blog,代码行数:5,代码来源:memcache.class.php


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