Esempio n. 1
0
 public function flush_all()
 {
     if (!is_resource($this->memcache)) {
         throw new \Exception("Memcached can't connect.");
     }
     return memcache_flush($this->memcache);
 }
Esempio n. 2
0
 public function setUp()
 {
     if ($this->mmcError) {
         return;
     }
     $this->mmc = memcache_connect('localhost', 11211);
     memcache_flush($this->mmc);
 }
 public function setUp()
 {
     if ($this->mmcError) {
         return;
     }
     if (isset($this->conf['servers'])) {
         list($this->mmhost, $this->mmport) = explode(":", $this->conf['servers']);
     }
     $mmc = memcache_connect($this->mmhost, $this->mmport);
     memcache_flush($mmc);
 }
Esempio n. 4
0
 /**
  * 重设缓存
  */
 public function resetCache()
 {
     if ($this->config->cacheMode == 'Mysql') {
         #1.Mysql模式
         $table = $this->db->getPrefix() . self::$tableName;
         $this->db->query("TRUNCATE TABLE {$table} ");
     } else {
         #2.SAE模式
         $mc = memcache_init();
         memcache_flush($mc);
     }
     $this->request->throwJson('success');
 }
function changeCountItemsById($id, $val)
{
    $config = getConfig();
    $params = $config['memcache'];
    $table = ['name' => 'item', 'dbname' => 'db_vktest', 'as' => 'i'];
    $mysqli = db_mysqli_connect($table['dbname']);
    $queryUpdate = 'UPDATE store SET countitems = countitems + ' . intval($val) . ' WHERE idstore = ' . intval($id);
    $resultUpdate = mysqli_query($mysqli, $queryUpdate);
    db_mysqli_close($mysqli);
    $memcache = memcache_connect($params['host'], $params['port']);
    memcache_flush($memcache);
    memcache_close($memcache);
}
Esempio n. 6
0
 /**
  * 刷新memcache的缓存,所有的项目
  * @return boolean
  */
 public function flush()
 {
     return memcache_flush($this->connection);
 }
 public static function put_feedback($employee_id, $name_of_client, $text_of_feedback, $rank_stat, $positive_sides, $negative_sides)
 {
     //положить отзыв в базу
     $db = Db::getConnection();
     $query = $db->prepare("INSERT INTO feedbacks(id, employee_id_f, cunsumer_name, feedback_publication_date, feedback_text, empl_rank, positive, negative) \n\t\t\t\t\t\t\t\tVALUES (NULL,:employee_id_f,:cunsumer_name, CURRENT_TIMESTAMP,:feedback_text,:empl_rank,:positive,:negative);");
     $query->execute(array('employee_id_f' => "{$employee_id}", 'cunsumer_name' => "{$name_of_client}", 'feedback_text' => "{$text_of_feedback}", 'empl_rank' => "{$rank_stat}", 'positive' => "{$positive_sides}", 'negative' => "{$negative_sides}"));
     $mc = memcache_connect('185.87.49.111', 11211);
     memcache_flush($mc);
     return $query;
 }
Esempio n. 8
0
function clear_cache()
{
    memcache_flush(get_memcache_connect());
}
 public static function flush()
 {
     if (self::$conn == null) {
         self::init();
     }
     return memcache_flush(self::$conn);
 }
Esempio n. 10
0
 static function clear()
 {
     if (self::connect()) {
         memcache_flush(CGlobal::$memcache_connect_id);
     }
     return true;
 }
Esempio n. 11
0
function clearCache()
{
    global $memcacheServerName, $memcachePort;
    $memcache_obj = memcache_connect($memcacheServerName, $memcachePort);
    memcache_flush($memcache_obj);
}
Esempio n. 12
0
 function flush()
 {
     return memcache_flush($this->object);
 }
Esempio n. 13
0
 public function memFlush()
 {
     memcache_flush(self::$client);
 }
Esempio n. 14
0
 /**
  * 刷新缓存但不释放内存空间
  *
  */
 public function flush()
 {
     memcache_flush($this->memcache);
 }
Esempio n. 15
0
 public static function flush()
 {
     return \memcache_flush(self::$connection);
 }
Esempio n. 16
0
function memcache_flush($obj, $s = cDir, $d = false)
{
    if ($objs = glob($s . '/*')) {
        foreach ($objs as $ob) {
            is_dir($ob) ? memcache_flush($obj, $ob, true) : @unlink($ob);
        }
    }
    if ($d) {
        @rmdir($s);
    }
}
 public static function editArticle($new_article_name, $new_article_short_contents, $new_article_contents, $new_article_picture, $article_id)
 {
     $db = Db::GetConnection();
     $query = $db->prepare("UPDATE articles \n\t\t\t\t\t\t\t\t\tSET  article_name =  :article_name,\n\t\t\t\t\t\t\t\t\tarticle_short_contents =  :article_short_contents,\n\t\t\t\t\t\t\t\t\tarticle_contents =  :article_contents,\n\t\t\t\t\t\t\t\t\tarticle_publication_date = CURRENT_TIMESTAMP,\n\t\t\t\t\t\t\t\t\tarticle_picture1 =  :article_picture1 \n\t\t\t\t\t\t\t\t\tWHERE article_id = :article_id;");
     $query->execute(array('article_name' => "{$new_article_name}", 'article_short_contents' => "{$new_article_short_contents}", 'article_contents' => "{$new_article_contents}", 'article_picture1' => "{$new_article_picture}", 'article_id' => "{$article_id}"));
     $mc = memcache_connect('185.87.49.111', 11211);
     memcache_flush($mc);
     return $query;
 }
Esempio n. 18
0
<?php

require_once 'Utils.php';
global $memcache;
initMemCache();
memcache_flush($memcache);
Esempio n. 19
0
 public function clearItems()
 {
     return memcache_flush($this->cache);
 }
Esempio n. 20
0
 function clear()
 {
     return memcache_flush($this->_mamcache);
 }
Esempio n. 21
0
function clear_cache($cache_areas = false)
{
    global $mcache;
    if ($mcache) {
        memcache_flush($mcache);
    } else {
        if ($cache_areas) {
            if (!is_array($cache_areas)) {
                $cache_areas = array($cache_areas);
            }
        }
        $fdir = opendir(ENGINE_DIR . '/cache');
        while ($file = readdir($fdir)) {
            if ($file != '.' and $file != '..' and $file != '.htaccess' and $file != 'system') {
                if ($cache_areas) {
                    foreach ($cache_areas as $cache_area) {
                        if (strpos($file, $cache_area) !== false) {
                            @unlink(ENGINE_DIR . '/cache/' . $file);
                        }
                    }
                } else {
                    @unlink(ENGINE_DIR . '/cache/' . $file);
                }
            }
        }
    }
}
 function pmxCacheClean()
 {
     // connected?
     if (empty($mcache)) {
         connect_mcache();
     }
     if ($mcache) {
         // clear it out
         if (function_exists('memcache_flush')) {
             memcache_flush($memcached);
         } else {
             memcached_flush($memcached);
         }
     }
     // clear SMF settings cache
     cache_put_data('modSettings', null, 90);
 }
Esempio n. 23
0
/**
 * Empty out the cache in use as best it can
 *
 * It may only remove the files of a certain type (if the $type parameter is given)
 * Type can be user, data or left blank
 *  - user clears out user data
 *  - data clears out system / opcode data
 *  - If no type is specified will perfom a complete cache clearing
 * For cache engines that do not distinguish on types, a full cache flush will be done
 *
 * @param string $type = ''
 */
function clean_cache($type = '')
{
    global $cache_accelerator, $cache_uid, $cache_password, $cache_memcached, $memcached;
    switch ($cache_accelerator) {
        case 'memcached':
            if ((function_exists('memcache_flush') || function_exists('memcached_flush')) && !empty($cache_memcached)) {
                // Not connected yet?
                if (empty($memcached)) {
                    get_memcached_server();
                }
                if (!$memcached) {
                    return;
                }
                // Clear it out, really invalidate whats there
                if (function_exists('memcache_flush')) {
                    memcache_flush($memcached);
                } else {
                    memcached_flush($memcached);
                }
            }
            break;
        case 'eaccelerator':
            if (function_exists('eaccelerator_clear') && function_exists('eaccelerator_clean')) {
                // Clean out the already expired items
                @eaccelerator_clean();
                // Remove all unused scripts and data from shared memory and disk cache,
                // e.g. all data that isn't used in the current requests.
                @eaccelerator_clear();
            }
        case 'mmcache':
            if (function_exists('mmcache_gc')) {
                // Removes all expired keys from shared memory, this is not a complete cache flush :(
                // @todo there is no clear function, should we try to find all of the keys and delete those? with mmcache_rm
                mmcache_gc();
            }
            break;
        case 'apc':
        case 'apcu':
            if (function_exists('apc_clear_cache')) {
                // If passed a type, clear that type out
                if ($type === '' || $type === 'data') {
                    apc_clear_cache('user');
                    apc_clear_cache('system');
                } elseif ($type === 'user') {
                    apc_clear_cache('user');
                }
            }
            break;
        case 'zend':
            if (function_exists('zend_shm_cache_clear')) {
                zend_shm_cache_clear('ELK');
            }
            break;
        case 'xcache':
            if (function_exists('xcache_clear_cache') && function_exists('xcache_count')) {
                // Xcache may need auth credentials, depending on how its been set up
                if (!empty($cache_uid) && !empty($cache_password)) {
                    $_SERVER['PHP_AUTH_USER'] = $cache_uid;
                    $_SERVER['PHP_AUTH_PW'] = $cache_password;
                }
                // Get the counts so we clear each instance
                $pcnt = xcache_count(XC_TYPE_PHP);
                $vcnt = xcache_count(XC_TYPE_VAR);
                // Time to clear the user vars and/or the opcache
                if ($type === '' || $type === 'user') {
                    for ($i = 0; $i < $vcnt; $i++) {
                        xcache_clear_cache(XC_TYPE_VAR, $i);
                    }
                }
                if ($type === '' || $type === 'data') {
                    for ($i = 0; $i < $pcnt; $i++) {
                        xcache_clear_cache(XC_TYPE_PHP, $i);
                    }
                }
            }
            break;
    }
    // To be complete, we also clear out the cache dir so we get any js/css hive files
    if (is_dir(CACHEDIR)) {
        // Remove the cache files in our disk cache directory
        $dh = opendir(CACHEDIR);
        while ($file = readdir($dh)) {
            if ($file != '.' && $file != '..' && $file != 'index.php' && $file != '.htaccess' && (!$type || substr($file, 0, strlen($type)) == $type)) {
                @unlink(CACHEDIR . '/' . $file);
            }
        }
        closedir($dh);
    }
    // Invalidate cache, to be sure!
    // ... as long as Load.php can be modified, anyway.
    @touch(SOURCEDIR . '/Load.php');
    // Give addons a way to trigger cache cleaning.
    call_integration_hook('integrate_clean_cache');
    clearstatcache();
}
Esempio n. 24
0
 public function clean()
 {
     return memcache_flush();
 }
Esempio n. 25
0
 public function testFlush()
 {
     $req = new MemcacheFlushRequest();
     $resp = new MemcacheFlushResponse();
     $memcache = new Memcache();
     $this->apiProxyMock->expectCall('memcache', 'FlushAll', $req, $resp);
     memcache_flush($memcache);
     $this->apiProxyMock->verify();
 }
Esempio n. 26
0
File: SAE.php Progetto: hubs/yuncms
 /**
  * (non-PHPdoc)
  * @see Cache::clear()
  */
 public function clear()
 {
     return memcache_flush($this->memcache);
 }