当前位置: 首页>>代码示例>>Java>>正文


Java GeneralCacheAdministrator类代码示例

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


GeneralCacheAdministrator类属于com.opensymphony.oscache.general包,在下文中一共展示了GeneralCacheAdministrator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSetting

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 获取系统配置信息
 * 
 * @return Setting
 */
public static Setting getSetting() {
	Setting setting = null;
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	try {
		setting = (Setting) generalCacheAdministrator.getFromCache(SETTING_CACHE_KEY);
	} catch (NeedsRefreshException needsRefreshException) {
		boolean updateSucceeded = false;
		try {
			setting = readSetting();
			generalCacheAdministrator.putInCache(SETTING_CACHE_KEY, setting);
			updateSucceeded = true;
		} catch(Exception e) {
			e.printStackTrace();
		} finally {
            if (!updateSucceeded) {
            	generalCacheAdministrator.cancelUpdate(SETTING_CACHE_KEY);
            }
        }
	}
	return setting;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:SettingUtil.java

示例2: flush

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 刷新支付产品缓存
 * 
 */
@SuppressWarnings("unchecked")
public void flush() {
	File shopxxXmlFile = null;
	Document document = null;
	try {
		shopxxXmlFile = new ClassPathResource(SHOPXX_XML_FILE_NAME).getFile();
		SAXReader saxReader = new SAXReader();
		document = saxReader.read(shopxxXmlFile);
	} catch (Exception e) {
		e.printStackTrace();
	}
	List<Node> nodeList = document.selectNodes("/shopxx/paymentProduct");
	Iterator<Node> iterator = nodeList.iterator();
	
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	while (iterator.hasNext()) {
		Node node = iterator.next();
		String paymentProductCacheKey = PAYMENT_PRODUCT_CACHE_KEY_PREFIX + node.getName();
		generalCacheAdministrator.flushEntry(paymentProductCacheKey);
	}
	String paymentProductListCacheKey = PAYMENT_PRODUCT_CACHE_KEY_PREFIX + "list";
	generalCacheAdministrator.flushEntry(paymentProductListCacheKey);
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:28,代码来源:PaymentProductUtil.java

示例3: cacheAdministrator

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
@Bean
public GeneralCacheAdministrator cacheAdministrator() throws IOException {
    CacheProperties.Oscahce oscahce = cacheProperties.getOscahce();
    Resource resource = oscahce.getConfiguration();
    if (resource == null || !resource.exists()) {
        resource = new ClassPathResource("/META-INF/oscache.properties", Thread.currentThread().getContextClassLoader());
    }

    Properties properties = new Properties();
    PropertiesLoaderUtils.fillProperties(properties, resource);

    return new GeneralCacheAdministrator(properties);
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:14,代码来源:OscacheCacheConfiguration.java

示例4: getMailTemplateConfig

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 根据名称获取MailTemplateConfig对象
 * 
 * @return MailTemplateConfig对象
 */
public static MailTemplateConfig getMailTemplateConfig(String name) {
	MailTemplateConfig mailTemplateConfig = null;
	String cacheKey = TEMPLATE_CACHE_KEY_PREFIX + "_MAIL_" + name;
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	try {
		mailTemplateConfig = (MailTemplateConfig) generalCacheAdministrator.getFromCache(cacheKey);
	} catch (NeedsRefreshException needsRefreshException) {
		boolean updateSucceeded = false;
		try {
			Document document = null;
			try {
				File templateXmlFile = new File(CommonUtil.getWebRootPath() + TEMPLATE_XML_FILE_PATH);
				SAXReader saxReader = new SAXReader();
				document = saxReader.read(templateXmlFile);
			} catch (Exception e) {
				e.printStackTrace();
			}
			Element element = (Element)document.selectSingleNode("/shopxx/mail/" + name);
			String description = element.element("description").getTextTrim();
			String subject = element.element("subject").getTextTrim();
			String templatePath = element.element("templatePath").getTextTrim();
			
			mailTemplateConfig = new MailTemplateConfig();
			mailTemplateConfig.setName(element.getName());
			mailTemplateConfig.setDescription(description);
			mailTemplateConfig.setSubject(subject);
			mailTemplateConfig.setTemplatePath(templatePath);
			
			generalCacheAdministrator.putInCache(cacheKey, mailTemplateConfig);
			updateSucceeded = true;
		} finally {
            if (!updateSucceeded) {
            	generalCacheAdministrator.cancelUpdate(cacheKey);
            }
        }
	}
	return mailTemplateConfig;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:44,代码来源:TemplateConfigUtil.java

示例5: init

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
	synchronized (this.getClass()) {
		ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(filterConfig.getServletContext());
		// Use the cache administrator created by Spring context.
		cacheAdministrator = (GeneralCacheAdministrator) context.getBean("cacheManager");
		blogService = (BlogService) context.getBean("blogService");
	}
}
 
开发者ID:rla,项目名称:old-blog,代码行数:10,代码来源:BlogPageCachingFilter.java

示例6: OscacheCache

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
public OscacheCache(String name, int expire, GeneralCacheAdministrator admin) {
    super(true);
    this.name = name;
    this.admin = admin;
    this.expire = expire;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:7,代码来源:OscacheCache.java

示例7: getNativeCache

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
@Override
public GeneralCacheAdministrator getNativeCache() {
    return admin;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:5,代码来源:OscacheCache.java

示例8: setAdmin

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
public void setAdmin(GeneralCacheAdministrator admin) {
    this.admin = admin;
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:4,代码来源:OscacheCacheManager.java

示例9: getObjectType

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * @see org.springframework.beans.factory.FactoryBean#getObjectType()
 */
public Class getObjectType() {
  return cacheManager != null ? cacheManager.getClass()
      : GeneralCacheAdministrator.class;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:OsCacheManagerFactoryBean.java

示例10: getAllLogConfigList

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 获得所有日志配置集合
 * 
 * @return 所有日志配置集合
 */
@SuppressWarnings("unchecked")
public static List<LogConfig> getAllLogConfigList() {
	List<LogConfig> allLogConfigList = null;
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	try {
		allLogConfigList = (List<LogConfig>) generalCacheAdministrator.getFromCache(ALL_LOG_CONFIG_LIST_CACHE_KEY);
	} catch (NeedsRefreshException needsRefreshException) {
		boolean updateSucceeded = false;
		try {
			File shopxxXmlFile = null;
			Document document = null;
			try {
				shopxxXmlFile = new ClassPathResource(SHOPXX_XML_FILE_NAME).getFile();
				SAXReader saxReader = new SAXReader();
				document = saxReader.read(shopxxXmlFile);
			} catch (Exception e) {
				e.printStackTrace();
			}
			List<Node> nodeList = document.selectNodes("/shopxx/logConfig/*");
			Iterator<Node> iterator = nodeList.iterator();
			
			allLogConfigList = new ArrayList<LogConfig>();
			while (iterator.hasNext()) {
				Element element = (Element) iterator.next();
				
				LogConfig logConfig = new LogConfig();
				logConfig.setOperation(element.attributeValue("operation"));
				logConfig.setActionClass(element.attributeValue("actionClass"));
				logConfig.setActionMethod(element.attributeValue("actionMethod"));
				allLogConfigList.add(logConfig);
			}
			generalCacheAdministrator.putInCache(ALL_LOG_CONFIG_LIST_CACHE_KEY, allLogConfigList);
			updateSucceeded = true;
		} finally {
            if (!updateSucceeded) {
            	generalCacheAdministrator.cancelUpdate(ALL_LOG_CONFIG_LIST_CACHE_KEY);
            }
        }
	}
	return allLogConfigList;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:47,代码来源:LogConfigUtil.java

示例11: flush

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 刷新日志配置缓存
 * 
 */
public static void flush() {
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	generalCacheAdministrator.flushEntry(ALL_LOG_CONFIG_LIST_CACHE_KEY);
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:9,代码来源:LogConfigUtil.java

示例12: updateSetting

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 更新系统配置信息
 * 
 * @param setting
 */
public static void updateSetting(Setting setting) {
	writeSetting(setting);
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	generalCacheAdministrator.flushEntry(SETTING_CACHE_KEY);
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:11,代码来源:SettingUtil.java

示例13: flush

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 刷新系统配置信息
 * 
 */
public void flush() {
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	generalCacheAdministrator.flushEntry(SETTING_CACHE_KEY);
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:9,代码来源:SettingUtil.java

示例14: getPageTemplateConfig

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
/**
 * 根据名称获取PageTemplateConfig对象
 * 
 * @return PageTemplateConfig对象
 */
public static PageTemplateConfig getPageTemplateConfig(String name) {
	PageTemplateConfig pageTemplateConfig = null;
	String cacheKey = TEMPLATE_CACHE_KEY_PREFIX + "_PAGE_" + name;
	logger.info("cacheKey:"+cacheKey);
	GeneralCacheAdministrator generalCacheAdministrator = (GeneralCacheAdministrator) SpringUtil.getBean(CACHE_MANAGER_BEAN_NAME);
	try {
		pageTemplateConfig = (PageTemplateConfig) generalCacheAdministrator.getFromCache(cacheKey);
	} catch (NeedsRefreshException needsRefreshException) {
		boolean updateSucceeded = false;
		try {
			Document document = null;
			try {
				File templateXmlFile = new File(CommonUtil.getWebRootPath() + TEMPLATE_XML_FILE_PATH);

		        logger.info("templateXmlFile path:"+templateXmlFile.getAbsolutePath());
				SAXReader saxReader = new SAXReader();
				document = saxReader.read(templateXmlFile);
			} catch (Exception e) {
				e.printStackTrace();
			}
			Element element = (Element)document.selectSingleNode("/shopxx/page/" + name);
			String description = element.element("description").getTextTrim();
			String templatePath = element.element("templatePath").getTextTrim();
			
			pageTemplateConfig = new PageTemplateConfig();
			if (element.element("htmlPath") != null) {
				String htmlPath = element.element("htmlPath").getTextTrim();
				pageTemplateConfig.setHtmlPath(htmlPath);
			}
			pageTemplateConfig.setName(element.getName());
			pageTemplateConfig.setDescription(description);
			pageTemplateConfig.setTemplatePath(templatePath);
			
			generalCacheAdministrator.putInCache(cacheKey, pageTemplateConfig);
			updateSucceeded = true;
		} finally {
            if (!updateSucceeded) {
            	generalCacheAdministrator.cancelUpdate(cacheKey);
            }
        }
	}
	return pageTemplateConfig;
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:49,代码来源:TemplateConfigUtil.java

示例15: OSCacheScriptCache

import com.opensymphony.oscache.general.GeneralCacheAdministrator; //导入依赖的package包/类
public OSCacheScriptCache()
  {
GeneralCacheAdministrator admin = new GeneralCacheAdministrator();
cache = admin.getCache();
assert(cache != null);
  }
 
开发者ID:lazerdye,项目名称:arrowheadasp,代码行数:7,代码来源:OSCacheScriptCache.java


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