本文整理匯總了PHP中Cache::drop方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::drop方法的具體用法?PHP Cache::drop怎麽用?PHP Cache::drop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cache
的用法示例。
在下文中一共展示了Cache::drop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
parent::tearDown();
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('xcache');
Cache::drop('xcache_groups');
Cache::config('default');
}
示例2: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('');
Cache::drop('redis_groups');
Cache::drop('redis_helper');
Cache::config('default');
}
示例3: endTest
/**
* tearDown method
*
* @return void
*/
public function endTest($method)
{
Cache::clear(false, 'database_test');
Configure::write('Cache.disable', $this->_cacheDisable);
Cache::drop('database_test');
Cache::config('default');
parent::endTest($method);
}
示例4: tearDown
/**
* end a test
*
* @return void
**/
function tearDown()
{
parent::tearDown();
unset($this->Helper);
Cache::delete(AssetConfig::CACHE_BUILD_TIME_KEY, AssetConfig::CACHE_CONFIG);
Cache::drop(AssetConfig::CACHE_CONFIG);
@unlink(TMP . AssetConfig::BUILD_TIME_FILE);
}
示例5: tearDown
public function tearDown()
{
SlugCache::clear();
SlugCache::config($this->slugCache);
Configure::write('Cache.disable', $this->disabled);
Cache::drop('SluggerTest');
parent::tearDown();
}
示例6: setUp
function setUp()
{
Cache::drop(AssetConfig::CACHE_CONFIG);
Cache::config(AssetConfig::CACHE_CONFIG, array('engine' => 'File'));
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->testConfig = $this->_pluginPath . 'tests' . DS . 'test_files' . DS . 'config' . DS . 'config.ini';
AssetConfig::clearAllCachedKeys();
$this->config = AssetConfig::buildFromIniFile($this->testConfig);
}
示例7: setUp
public function setUp()
{
parent::setUp();
$this->_config = Configure::read();
Configure::write('Config.language', 'ja');
Cache::drop('_cake_core_');
I18n::clear();
App::build(array('locales' => array(App::pluginPath('YamlReader') . 'Test' . DS . 'files' . DS . 'Locale' . DS)), true);
}
示例8: tearDown
/**
* end a test
*
* @return void
*/
public function tearDown() {
parent::tearDown();
unset($this->Helper);
Cache::delete(AssetConfig::CACHE_BUILD_TIME_KEY, AssetConfig::CACHE_CONFIG);
Cache::drop(AssetConfig::CACHE_CONFIG);
// @codingStandardsIgnoreStart
@unlink(TMP . AssetConfig::BUILD_TIME_FILE);
// @codingStandardsIgnoreEnd
}
示例9: setUp
public function setUp()
{
parent::setUp();
Cache::drop(AssetConfig::CACHE_CONFIG);
Cache::config(AssetConfig::CACHE_CONFIG, array('engine' => 'File'));
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->_testFiles = App::pluginPath('AssetCompress') . 'Test' . DS . 'test_files' . DS;
$this->testConfig = $this->_testFiles . 'Config' . DS . 'config.ini';
$this->_themeConfig = $this->_testFiles . 'Config' . DS . 'themed.ini';
AssetConfig::clearAllCachedKeys();
$this->config = AssetConfig::buildFromIniFile($this->testConfig);
}
示例10: onLogin
public function onLogin() {
$hash = md5($this->id . ' ' . time() . ' ' . rand(1, 1000));
$query = 'INSERT INTO `users_session` SET
`user_id`=' . $this->id . ',
`session`=\'' . $hash . '\',
`expires`=' . (time() + Config::need('auth_cookie_lifetime')) . '
ON DUPLICATE KEY UPDATE
`session`=\'' . $hash . '\',
`expires`=' . (time() + Config::need('auth_cookie_lifetime'));
Database::query($query);
Cache::drop('auth_' . $this->id);
$this->setProperty('lastLogin', time());
$this->setAuthCookie($hash);
}
示例11: write
function write()
{
global $current_user;
/* @var $current_user CurrentUser */
if ($current_user->authorized) {
$mask = array('id' => 'int', 'bday' => 'string', 'city_id' => 'int', 'link_fb' => array('type' => 'string', '*' => true), 'link_vk' => array('type' => 'string', '*' => true), 'link_lj' => array('type' => 'string', '*' => true), 'link_tw' => array('type' => 'string', '*' => true), 'quote' => array('type' => 'string', '*' => true), 'about' => array('type' => 'string', '*' => true));
$params = Request::checkPostParameters($mask);
if ($current_user->id == $params['id']) {
//avatar
if (isset($_FILES['picture']) && $_FILES['picture']['tmp_name']) {
$filename = Config::need('avatar_upload_path') . '/' . $current_user->id . '.jpg';
$upload = new UploadAvatar($_FILES['picture']['tmp_name'], 100, 100, "simple", $filename);
if ($upload->out) {
$current_user->setProperty('picture', 1);
} else {
throw new Exception('cant copy file to ' . $filename, 100);
}
}
//bday
$current_user->setProperty('bday', max(0, (int) @strtotime($params['bday'])));
// city
$current_user->setProperty('city_id', $params['city_id']);
// facebook etc
$current_user->setPropertySerialized('link_fb', $params['link_fb']);
$current_user->setPropertySerialized('link_vk', $params['link_vk']);
$current_user->setPropertySerialized('link_tw', $params['link_tw']);
$current_user->setPropertySerialized('link_lj', $params['link_lj']);
$params['quote'] = htmlspecialchars($params['quote']);
$params['about'] = htmlspecialchars($params['about']);
$current_user->setPropertySerialized('quote', $params['quote']);
$current_user->setPropertySerialized('about', $params['about']);
$current_user->save();
// после редактирования профиля надо посбрасывать кеш со страницы профиля
// и со страницы редактирования профиля
// кеш в остальных модулях истечет сам
Cache::drop(Request::$pageName . '_ProfileModule_' . $current_user->id, Cache::DATA_TYPE_XML);
//xmlthemeDefault_ru_user_ProfileModule
Cache::drop(Request::$pageName . '_ProfileModule_' . $current_user->id . 'edit', Cache::DATA_TYPE_XML);
//xmlthemeDefault_ru_user_ProfileModule_19
}
}
}
示例12: testDrop
/**
* test that drop removes cache configs, and that further attempts to use that config
* do not work.
*
* @return void
*/
function testDrop()
{
App::build(array('libs' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'libs' . DS), 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)), true);
$result = Cache::drop('some_config_that_does_not_exist');
$this->assertFalse($result);
$_testsConfig = Cache::config('tests');
$result = Cache::drop('tests');
$this->assertTrue($result);
Cache::config('unconfigTest', array('engine' => 'TestAppCache'));
$this->assertTrue(Cache::isInitialized('unconfigTest'));
$this->assertTrue(Cache::drop('unconfigTest'));
$this->assertFalse(Cache::isInitialized('TestAppCache'));
Cache::config('tests', $_testsConfig);
App::build();
}
示例13: dropCache
public function dropCache($id) {
Cache::drop($this->itemName . '_' . $id);
unset($this->items[$id]);
}
示例14: testMaskSetting
/**
* Testing the mask setting in FileEngine
*
* @return void
*/
public function testMaskSetting()
{
if (DS === '\\') {
$this->markTestSkipped('File permission testing does not work on Windows.');
}
Cache::config('mask_test', array('engine' => 'File', 'path' => TMP . 'tests'));
$data = 'This is some test content';
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0664';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0666';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0644';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0640';
$this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test');
Cache::drop('mask_test');
}
示例15: testMultipleServers
/**
* testSettings method
*
* @access public
* @return void
*/
function testMultipleServers()
{
$servers = array('127.0.0.1:11211', '127.0.0.1:11222');
$available = true;
$Memcache =& new Memcache();
foreach ($servers as $server) {
list($host, $port) = explode(':', $server);
if (!@$Memcache->connect($host, $port)) {
$available = false;
}
}
if ($this->skipIf(!$available, '%s Need memcache servers at ' . implode(', ', $servers) . ' to run this test')) {
return;
}
$Memcache =& new MemcacheEngine();
$Memcache->init(array('engine' => 'Memcache', 'servers' => $servers));
$servers = array_keys($Memcache->__Memcache->getExtendedStats());
$settings = $Memcache->settings();
$this->assertEqual($servers, $settings['servers']);
Cache::drop('dual_server');
}