本文整理汇总了PHP中OW::getCacheManager方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getCacheManager方法的具体用法?PHP OW::getCacheManager怎么用?PHP OW::getCacheManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getCacheManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCleanUp
public function processCleanUp()
{
$configs = OW::getConfig()->getValues('cacheextreme');
//clean template cache
if ($configs['template_cache']) {
OW_ViewRenderer::getInstance()->clearCompiledTpl();
}
//clean db backend cache
if ($configs['backend_cache']) {
OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL);
}
//clean themes static contents cache
if ($configs['theme_static']) {
OW::getThemeManager()->getThemeService()->processAllThemes();
}
//clean plugins static contents cache
if ($configs['plugin_static']) {
$pluginService = BOL_PluginService::getInstance();
$activePlugins = $pluginService->findActivePlugins();
/* @var $pluginDto BOL_Plugin */
foreach ($activePlugins as $pluginDto) {
$pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS;
if (file_exists($pluginStaticDir)) {
$staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS;
if (file_exists($staticDir)) {
UTIL_File::removeDir($staticDir);
}
mkdir($staticDir);
chmod($staticDir, 0777);
UTIL_File::copyDir($pluginStaticDir, $staticDir);
}
}
}
}
示例2: addLink
public function addLink($userId, $href, $title, $description, $thumbnailUrl, $text = null, $addToFeed = true)
{
if (!$this->isActive()) {
return null;
}
OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT));
$service = LinkService::getInstance();
$url = mb_ereg_match('^http(s)?:\\/\\/', $href) ? $href : 'http://' . $href;
$link = new Link();
$eventParams = array('action' => LinkService::PRIVACY_ACTION_VIEW_LINKS, 'ownerId' => OW::getUser()->getId());
$privacy = OW::getEventManager()->getInstance()->call('plugin.privacy.get_privacy', $eventParams);
if (!empty($privacy)) {
$link->setPrivacy($privacy);
}
$link->setUserId($userId);
$link->setTimestamp(time());
$link->setUrl($url);
$link->setDescription(strip_tags($description));
$title = empty($title) ? $text : $title;
$link->setTitle(strip_tags($title));
$service->save($link);
if ($addToFeed) {
$content = array("format" => null, "vars" => array("status" => $text));
if (!empty($thumbnailUrl)) {
$content["format"] = "image_content";
$content["vars"]["image"] = $thumbnailUrl;
$content["vars"]["thumbnail"] = $thumbnailUrl;
}
//Newsfeed
$event = new OW_Event('feed.action', array('pluginKey' => 'links', 'entityType' => 'link', 'entityId' => $link->getId(), 'userId' => $link->getUserId()), array("content" => $content));
OW::getEventManager()->trigger($event);
}
return $link->id;
}
示例3: init
/**
* Application init actions.
*/
public function init()
{
// $this->urlHostRedirect();
// //printVar(10);exit;
$this->userAutoLogin();
// setting default time zone
date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone'));
// OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel');
// OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument');
//
// // router init - need to set current page uri and base url
$router = OW::getRouter();
$router->setBaseUrl(OW_URL_HOME . 'api/');
$uri = OW::getRequest()->getRequestUri();
// before setting in router need to remove get params
if (strstr($uri, '?')) {
$uri = substr($uri, 0, strpos($uri, '?'));
}
$router->setUri($uri);
$router->setDefaultRoute(new OW_ApiDefaultRoute());
$beckend = OW::getEventManager()->call('base.cache_backend_init');
if ($beckend !== null) {
OW::getCacheManager()->setCacheBackend($beckend);
OW::getCacheManager()->setLifetime(3600);
OW::getDbo()->setUseCashe(true);
}
OW::getResponse()->setDocument($this->newDocument());
}
示例4: delete
public function delete(Link $dto)
{
BOL_CommentService::getInstance()->deleteEntityComments('link', $dto->getId());
BOL_TagService::getInstance()->deleteEntityTags($dto->getId(), 'link');
BOL_VoteService::getInstance()->deleteEntityItemVotes($dto->getId(), 'link');
BOL_FlagService::getInstance()->deleteByTypeAndEntityId('link', $dto->getId());
OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT));
OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'link', 'entityId' => $dto->getId())));
$this->dao->delete($dto);
}
示例5: clearCache
protected function clearCache()
{
$tagsToClear = $this->getClearCacheTags();
if ($tagsToClear) {
OW::getCacheManager()->clean($tagsToClear);
}
}
示例6: onUnregisterUser
public function onUnregisterUser(OW_Event $event)
{
$params = $event->getParams();
if (empty($params['deleteContent'])) {
return;
}
OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT));
$userId = $params['userId'];
$count = (int) $this->service->countUserPost($userId);
if ($count == 0) {
return;
}
$list = $this->service->findUserPostList($userId, 0, $count);
foreach ($list as $post) {
$this->service->delete($post);
}
}
示例7: clearUserListQueryCache
public function clearUserListQueryCache(OW_Event $event)
{
$params = $event->getParams();
$userId = (int) $params['userId'];
OW::getCacheManager()->clean(array(BOL_UserDao::CACHE_TAG_ALL_USER_LIST));
}
示例8: clearCache
protected function clearCache()
{
OW::getCacheManager()->clean(array(BOL_ThemeDao::CACHE_TAG_PAGE_LOAD_THEME));
}
示例9: clearCache
public function clearCache()
{
OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT));
}
示例10: OW_Event
if (!isset($_GET['ow-light-cron']) && !OW::getConfig()->getValue('base', 'cron_is_configured')) {
if (OW::getConfig()->configExists('base', 'cron_is_configured')) {
OW::getConfig()->saveConfig('base', 'cron_is_configured', 1);
} else {
OW::getConfig()->addConfig('base', 'cron_is_configured', 1);
}
}
OW::getRouter()->setBaseUrl(OW_URL_HOME);
OW::getPluginManager()->initPlugins();
$event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT);
OW::getEventManager()->trigger($event);
//init cache manager
$beckend = OW::getEventManager()->call('base.cache_backend_init');
if ($beckend !== null) {
OW::getCacheManager()->setCacheBackend($beckend);
OW::getCacheManager()->setLifetime(3600);
OW::getDbo()->setUseCashe(true);
}
OW::getThemeManager()->initDefaultTheme();
// setting current theme
$activeThemeName = OW::getConfig()->getValue('base', 'selectedTheme');
if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) {
OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName)));
}
$plugins = BOL_PluginService::getInstance()->findActivePlugins();
foreach ($plugins as $plugin) {
/* @var $plugin BOL_Plugin */
$pluginRootDir = OW::getPluginManager()->getPlugin($plugin->getKey())->getRootDir();
if (file_exists($pluginRootDir . DS . 'cron.php')) {
include $pluginRootDir . DS . 'cron.php';
$className = strtoupper($plugin->getKey()) . '_Cron';
示例11: getCacheManager
/**
* @return OW_CacheManager
*/
private function getCacheManager()
{
return OW::getCacheManager();
}
示例12: clearCache
protected function clearCache()
{
OW::getCacheManager()->clean(array(FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIENDS_COUNT, FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIEND_ID_LIST));
}
示例13: clearCache
public function clearCache()
{
OW::getCacheManager()->clean(array(NEWSFEED_BOL_ActionDao::CACHE_TAG_ALL, NEWSFEED_BOL_ActionDao::CACHE_TAG_INDEX, NEWSFEED_BOL_ActionDao::CACHE_TAG_USER, NEWSFEED_BOL_ActionDao::CACHE_TAG_FEED));
}
示例14: updateBlogsPrivacy
public function updateBlogsPrivacy($userId, $privacy)
{
$count = $this->countUserPost($userId);
$entities = PostService::getInstance()->findUserPostList($userId, 0, $count);
$entityIds = array();
foreach ($entities as $post) {
$entityIds[] = $post->getId();
}
$status = $privacy == 'everybody' ? true : false;
$event = new OW_Event('base.update_entity_items_status', array('entityType' => 'blog-post', 'entityIds' => $entityIds, 'status' => $status));
OW::getEventManager()->trigger($event);
$this->dao->updateBlogsPrivacy($userId, $privacy);
OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT));
}
示例15: clearCache
protected function clearCache()
{
OW::getCacheManager()->clean(array(self::CACHE_TAG_ADS_BANNERS));
}