本文整理汇总了PHP中Cache::expire方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::expire方法的具体用法?PHP Cache::expire怎么用?PHP Cache::expire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache::expire方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_plugin_deactivation
function action_plugin_deactivation($file)
{
// Remove the periodical execution event
CronTab::delete_cronjob('incoming_links');
// Clear the cached links
Cache::expire('incoming_links');
}
示例2: test_has_group
public function test_has_group()
{
Cache::expire(array('*', 'bar'), 'glob');
$this->assertFalse(Cache::has_group('foo'), 'The cache has a group that was explicitly expired.');
Cache::set(array('foo', 'bar'), 'a value');
$this->assertTrue(Cache::has_group('foo'), 'The cache does not have a group that was explicitly set.');
}
示例3: action_plugin_deactivation
public function action_plugin_deactivation($file = '')
{
if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
$class_name = strtolower(get_class($this));
// dump our cached list
Cache::expire($class_name . ':list');
}
}
示例4: test_expire
public function test_expire()
{
$value = rand(0, 999999);
Cache::set('habari:test', $value);
$this->assert_true(Cache::has('habari:test'), 'Cache value not stored as expected.');
Cache::expire('habari:test');
$this->assert_false(Cache::has('habari:test'), 'Cache value did not expire as expected.');
}
示例5: action_plugin_deactivation
function action_plugin_deactivation($file)
{
if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
// remove the module from the dash if it is active
Modules::remove_by_name('Incoming Links');
// Remove the periodical execution event
CronTab::delete_cronjob('incoming_links');
// Clear the cached links
Cache::expire('incoming_links');
}
}
示例6: cache_invalidate
/**
* Invalidates (expires) the cache entries for the give list of URLs.
*
* @param array $urls An array of urls to clear
*/
public function cache_invalidate(array $urls)
{
// account for annonymous user (id=0)
$user_ids = array_map(create_function('$a', 'return $a->id;'), Users::get_all()->getArrayCopy());
array_push($user_ids, "0");
// expire the urls for each user id
foreach ($user_ids as $user_id) {
foreach ($urls as $url) {
$request_id = self::get_request_id($user_id, $url);
if (Cache::has(array(self::GROUP_NAME, $request_id))) {
Cache::expire(array(self::GROUP_NAME, $request_id));
EventLog::log('Clearing request ID: ' . $request_id, 'info', 'plugin', 'StaticCache');
}
}
}
}
示例7: action_post_delete_after
public function action_post_delete_after($post)
{
if (Post::status_name($post->status) == 'published') {
Cache::expire($this->cache_name);
}
}
示例8: clearCache
function clearCache()
{
Cache::expire('feedburner_stat_site-rank');
Cache::expire('feedburner_stat_visitors-online');
Cache::expire('feedburner_stat_visitors-unique');
Cache::expire('feedburner_stat_actions');
Cache::expire('feedburner_stat_actions-average');
Cache::expire('feedburner_stat_time-total-pretty');
Cache::expire('feedburner_stat_time-average-pretty');
echo '<p>' . _t('Cache has been cleared.') . '</p>';
return true;
}
示例9: get_dashboard
/**
* Handles get requests for the dashboard
* @todo update check should probably be cron'd and cached, not re-checked every load
*/
public function get_dashboard()
{
// Not sure how best to determine this yet, maybe set an option on install, maybe do this:
$firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
if (intval($firstpostdate) !== 0) {
$firstpostdate = time() - $firstpostdate;
}
$this->theme->active_time = array('years' => floor($firstpostdate / 31556736), 'months' => floor($firstpostdate % 31556736 / 2629728), 'days' => round($firstpostdate % 2629728 / 86400));
// get the active theme, so we can check it
$active_theme = Themes::get_active();
$active_theme = $active_theme->name . ':' . $active_theme->version;
// if the active plugin list has changed, expire the updates cache
if (Cache::has('dashboard_updates') && Cache::get('dashboard_updates_plugins') != Options::get('active_plugins')) {
Cache::expire('dashboard_updates');
}
// if the theme version has changed, expire the updates cache
if (Cache::has('dashboard_updates') && Cache::get('dashboard_updates_theme') != $active_theme) {
Cache::expire('dashboard_updates');
}
/*
* Check for updates to core and any hooked plugins
* cache the output so we don't make a request every load but can still display updates
*/
if (Cache::has('dashboard_updates')) {
$this->theme->updates = Cache::get('dashboard_updates');
} else {
$updates = Update::check();
if (!Error::is_error($updates)) {
Cache::set('dashboard_updates', $updates);
$this->theme->updates = $updates;
// cache the set of plugins we just used to check for
Cache::set('dashboard_updates_plugins', Options::get('active_plugins'));
// cache the active theme we just used to check for
Cache::set('dashboard_updates_theme', $active_theme);
} else {
$this->theme->updates = array();
}
}
$this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'page_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('published'))), 'entry_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total(Comment::STATUS_APPROVED, FALSE), 'tag_count' => Tags::count_total(), 'page_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('page'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'entry_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('entry'), 'status' => Post::status('draft'), 'user_id' => User::identify()->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_UNAPPROVED, FALSE) : Comments::count_by_author(User::identify()->id, Comment::STATUS_UNAPPROVED), 'spam_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total(Comment::STATUS_SPAM, FALSE) : Comments::count_by_author(User::identify()->id, Comment::STATUS_SPAM), 'user_entry_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => User::identify()->id)));
$this->fetch_dashboard_modules();
// check for first run
$u = User::identify();
if (!isset($u->info->experience_level)) {
$this->theme->first_run = true;
$u->info->experience_level = 'user';
$u->info->commit();
} else {
$this->theme->first_run = false;
}
$this->display('dashboard');
}
示例10: action_handler_snapshot_delete
public function action_handler_snapshot_delete($handler_vars)
{
if (!User::identify()->can('snapshot', 'delete')) {
Utils::redirect(URL::get('admin', array('page' => 'unauthorized')));
}
$timestamp = Controller::get_var('ts');
$snapshots = Options::get('exportsnapshot__snapshots', array());
if (!isset($snapshots[$timestamp])) {
die('Unknown snapshot!');
}
// expire the snapshot in the cache
Cache::expire('exportsnapshot__' . $timestamp);
// remove it from the list
unset($snapshots[$timestamp]);
// write a log event
EventLog::log(_t('Export Snapshot deleted!', 'exportsnapshot'), 'info', 'delete', 'ExportSnapshot');
// save the list
Options::set('exportsnapshot__snapshots', $snapshots);
// and redirect back to the dashboard
Utils::redirect(URL::get('admin'));
}
示例11: filter_mollom_update_stats_cron
public function filter_mollom_update_stats_cron($result = true)
{
Cache::expire('mollom_stats');
$this->get_stats();
}
示例12: pieError
} else {
// Create diff from two versions.
if (!($data = $diff->diff($old['source'], $new['source']))) {
pieError('DiffError');
}
}
if ($GLOBALS['pie']['query_caching']) {
// Write to cache.
if (!($f = fopen($cache->file($cid), 'w'))) {
pieError('CacheWriteError');
}
if (!fwrite($f, $data)) {
pieError('CacheWriteError');
}
fclose($f);
$cache->expire('diff', 86400);
}
$data = explode("\n", trim($data));
$from = array();
$to = array();
foreach ($data as $line) {
switch ($line[0]) {
case '=':
if (!preg_match('/^(\\d+):(\\d+)$/', substr($line, 1), $match)) {
pieError('FormatError');
}
$from[] = nl2br(htmlspecialchars(substr($old['source'], $match[1], $match[2])));
$to[] = nl2br(htmlspecialchars(substr($old['source'], $match[1], $match[2])));
break;
case '+':
case '&':
示例13: set_default_options
public function set_default_options()
{
Options::set('darkautumn__bannercolor', '#f9683c');
Options::set('darkautumn__linkscolor', '#5cc5c9');
Options::set('darkautumn__bgcolor', '#fafafa');
Options::set('darkautumn__hovercolor', '#1ce0e7');
Options::set('darkautumn__bannerimage', '');
Options::set('darkautumn__showupperimg', true);
Options::set('darkautumn__showlowerimg', true);
Options::set('darkautumn__sidenotestag', 'aside');
Options::set('darkautumn__feedtext', 'Atom Feed');
Options::set('darkautumn__maintenancetitle', 'Site Down For Maintenance');
Options::set('darkautumn__blurbtext', 'Enter Some text about you, your site, or both here.');
Options::set('darkautumn__configured', true);
if (Cache::has('darkautum_options')) {
Cache::expire('darkautum_options');
}
}
示例14: init
/**
* Initialisation
*/
public static function init()
{
self::$path = __DIR__ . '/../tmp/cache';
// self::$expire = 60 * 60 * 24;
self::$expire = 60 * 5;
}
示例15: pieGetOption
}
pieHead();
if (@$_REQUEST['page']) {
// Purge the cache of a single page.
$_REQUEST['page'] = pieGetOption($_REQUEST['page']);
$_REQUEST['page'] = pieBeautifyName($_REQUEST['page']);
if (!$page->isValidName($_REQUEST['page'])) {
pieError('PageNameInvalid');
}
if (!$page->exists($_REQUEST['page'])) {
pieError('PageNotFound');
}
$cid = $cache->key('page', array('page' => $_REQUEST['page']));
if (!$cache->exists($cid)) {
pieError('PurgeSuccess');
}
if ($cache->delete($cid)) {
pieNotice('PurgeSuccess');
} else {
pieError('PurgeError');
}
} else {
// Purge the caches of all pages.
if ($cache->expire('page', 0)) {
pieNotice('ExpirationSuccess');
} else {
pieError('ExpirationError');
}
}
pieLog('edit');
pieTail();