• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP memcache_delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: delete_memcache_data

/**
 * 删除内存内容.
 *
 * @author dolphin
 *
 * @param string $key 内容KEY
 *
 * @return boolean布尔值(真|假)
 */
function delete_memcache_data($key)
{
    if (function_exists('memcache_connect')) {
        $memcache_object1 = @memcache_connect($GLOBALS['memcache_server1'], $GLOBALS['memcache_port']);
        $memcache_object2 = @memcache_connect($GLOBALS['memcache_server2'], $GLOBALS['memcache_port']);
    }
    if (is_object($memcache_object1)) {
        memcache_delete($memcache_object1, $key);
    }
    if (is_object($memcache_object2)) {
        memcache_delete($memcache_object2, $key);
    }
    return true;
}
开发者ID:netroby,项目名称:ecshop,代码行数:23,代码来源:lib_maifou.php


示例17: delete

 /**
  * @inheritDoc
  * @param String $key
  */
 public function delete($key)
 {
     $this->check();
     @memcache_delete($this->connection, $key);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:9,代码来源:Google_MemcacheCache.php


示例18: reset

 /**
  *	Clear contents of cache backend
  *	@return bool
  *	@param $suffix string
  *	@param $lifetime int
  **/
 function reset($suffix = NULL, $lifetime = 0)
 {
     if (!$this->dsn) {
         return TRUE;
     }
     $regex = '/' . preg_quote($this->prefix . '.', '/') . '.+?' . preg_quote($suffix, '/') . '/';
     $parts = explode('=', $this->dsn, 2);
     switch ($parts[0]) {
         case 'apc':
             $info = apc_cache_info('user');
             foreach ($info['cache_list'] as $item) {
                 if (preg_match($regex, $item['info']) && $item['mtime'] + $lifetime < time()) {
                     apc_delete($item['info']);
                 }
             }
             return TRUE;
         case 'memcache':
             foreach (memcache_get_extended_stats($this->ref, 'slabs') as $slabs) {
                 foreach (array_filter(array_keys($slabs), 'is_numeric') as $id) {
                     foreach (memcache_get_extended_stats($this->ref, 'cachedump', $id) as $data) {
                         if (is_array($data)) {
                             foreach ($data as $key => $val) {
                                 if (preg_match($regex, $key) && $val[1] + $lifetime < time()) {
                                     memcache_delete($this->ref, $key);
                                 }
                             }
                         }
                     }
                 }
             }
             return TRUE;
         case 'wincache':
             $info = wincache_ucache_info();
             foreach ($info['ucache_entries'] as $item) {
                 if (preg_match($regex, $item['key_name']) && $item['use_time'] + $lifetime < time()) {
                     apc_delete($item['key_name']);
                 }
             }
             return TRUE;
         case 'xcache':
             return TRUE;
             /* Not supported */
         /* Not supported */
         case 'folder':
             if ($glob = @glob($parts[1] . '*')) {
                 foreach ($glob as $file) {
                     if (preg_match($regex, basename($file)) && filemtime($file) + $lifetime < time()) {
                         @unlink($file);
                     }
                 }
             }
             return TRUE;
     }
     return FALSE;
 }
开发者ID:Mumcio,项目名称:bookmark-manager,代码行数:61,代码来源:base.php


示例19: reset

 /**
  *	Clear contents of cache backend
  *	@return bool
  *	@param $suffix string
  *	@param $lifetime int
  **/
 function reset($suffix = NULL, $lifetime = 0)
 {
     if (!$this->dsn) {
         return TRUE;
     }
     $regex = '/' . preg_quote($this->prefix . '.', '/') . '.+?' . preg_quote($suffix, '/') . '/';
     $parts = explode('=', $this->dsn, 2);
     switch ($parts[0]) {
         case 'apc':
         case 'apcu':
             $info = apc_cache_info('user');
             if (!empty($info['cache_list'])) {
                 $key = array_key_exists('info', $info['cache_list'][0]) ? 'info' : 'key';
                 $mtkey = array_key_exists('mtime', $info['cache_list'][0]) ? 'mtime' : 'modification_time';
                 foreach ($info['cache_list'] as $item) {
                     if (preg_match($regex, $item[$key]) && $item[$mtkey] + $lifetime < time()) {
                         apc_delete($item[$key]);
                     }
                 }
             }
             return TRUE;
         case 'redis':
             $fw = Base::instance();
             $keys = $this->ref->keys($this->prefix . '.*' . $suffix);
             foreach ($keys as $key) {
                 $val = $fw->unserialize($this->ref->get($key));
                 if ($val[1] + $lifetime < time()) {
                     $this->ref->del($key);
                 }
             }
             return TRUE;
         case 'memcache':
             foreach (memcache_get_extended_stats($this->ref, 'slabs') as $slabs) {
                 foreach (array_filter(array_keys($slabs), 'is_numeric') as $id) {
                     foreach (memcache_get_extended_stats($this->ref, 'cachedump', $id) as $data) {
                         if (is_array($data)) {
                             foreach ($data as $key => $val) {
                                 if (preg_match($regex, $key) && $val[1] + $lifetime < time()) {
                                     memcache_delete($this->ref, $key);
                                 }
                             }
                         }
                     }
                 }
             }
             return TRUE;
         case 'wincache':
             $info = wincache_ucache_info();
             foreach ($info['ucache_entries'] as $item) {
                 if (preg_match($regex, $item['key_name']) && $item['use_time'] + $lifetime < time()) {
                     wincache_ucache_delete($item['key_name']);
                 }
             }
             return TRUE;
         case 'xcache':
             return TRUE;
             /* Not supported */
         /* Not supported */
         case 'folder':
             if ($glob = @glob($parts[1] . '*')) {
                 foreach ($glob as $file) {
                     if (preg_match($regex, basename($file)) && filemtime($file) + $lifetime < time()) {
                         @unlink($file);
                     }
                 }
             }
             return TRUE;
     }
     return FALSE;
 }
开发者ID:eghojansu,项目名称:moe,代码行数:76,代码来源:Cache.php


示例20: removeFromCache

 /**
  * Remove a value in the remote cache store
  *
  * @access	public
  * @param	string		Cache unique key
  * @return	boolean		Cache removal successful
  */
 public function removeFromCache($key)
 {
     return memcache_delete($this->link, md5($this->identifier . $key));
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:11,代码来源:classCacheMemcache.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP memcache_get_extended_stats函数代码示例发布时间:2022-05-15
下一篇:
PHP memcache_close函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap