ehchche配置中配置多個快取物件
- URL url = CacheHelper.class.getClassLoader().getResource("ehcache.xml");
- CacheManager manager = new CacheManager(url);
- // __DEFAULT__
- System.out.println(manager.getName());
- URL url2 = CacheHelper.class.getClassLoader().getResource("ehcache2.xml");
- CacheManager manager2 = new CacheManager(url2);
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<!--<diskStore path="/home/uat_dm/log/ehcache/oss"/>-->
<diskStore path="java.io.tmpdir/hibernate/oss" />
<defaultCache maxElementsInMemory="10000" memoryStoreEvictionPolicy="LRU" eternal="false"
timeToIdleSeconds="300" timeToLiveSeconds="300" overflowToDisk="false" diskPersistent="false" />
<!-- acegi cache-->
<cache name="userCache"
maxElementsInMemory="10000"
eternal="true"
overflowToDisk="true"/>
<!-- acegi cache-->
<cache name="resourceCache"
maxElementsInMemory="10000"
eternal="true"
overflowToDisk="true"/>
<cache name="paramCache"
maxElementsInMemory="10000"
eternal="true"
overflowToDisk="true"/>
</ehcache>
建立這些快取物件,如何使用嫩
//建立CacheManager物件
CacheManager manager = CacheManager.getInstance();
if(manager == null)
manager = CacheManager.create();
//通過Cachemanager物件
cache = manager.getCache("paramCache");
if(cache == null){
log.error("init cache failed");
manager.addCache("paramCache");
//獲取ehcache.xmL配置檔案裡的cache物件
cache = manager.getCache("paramCache");
}
for(TC09ParamDic c09 : c09List){
ParamCacheKey key = new ParamCacheKey(c09.getParamName(), c09.getValue());
cache.put(new Element(key, c09));
}
相關推薦
ehchche配置中配置多個快取物件
Ehcache不允許建立同樣名稱的CacheManager物件。如果我們沒有ehcache.xml中配置CacaheManager的名稱,那麼預設的名稱是__DEFAULT__。解決方式是<ehcache name="">中配置CacheManager的名稱,並
git配置中出現多個重復名字:More than one value for the key user.name
for val config repl -s user nvic -c 區域 #### 查看配置```git config --list``` #### 查看所有的名稱```git config --get-all user.name``` #### 查
SpringBoot中對多個配置檔案中的屬性進行提取的簡易方法
我們要提取一下屬性: 首先建立一個GirlProperties類 package com.springboot.properties; import org.springframework.boot.context.properties.ConfigurationPropertie
Spring中配置和讀取多個Properties檔案--轉
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> &
Jenkins pipeline中下載多個配置庫
場景: 流水構建場景有時候需要下載多個配置庫的程式碼 參考https://stackoverflow.com/questions/40224272/using-a-jenkins-pipeline-to-checkout-multiple-g
如何在spring中配置集合供多個Bean使用
一:Utility Scheme 1.使用基本的集合標籤定義集合時,不能將集合作為獨立的Bean定義,導致其他Bean無法引用該集合,所以無法在不同Bean之間 共享集合。 2.可以使用Utility Scheme裡的集合標籤定義獨立的集合Bean,需要的是在B
classpath:和classpath*:的區別以及web.xml中載入多個配置檔案
首先我們都知道要使用spring,則需要在web.xml中增加如下程式碼: Xml程式碼 <listener> <listener-class> org.springfram
五、Django專案中包含多個應用時對url的配置
一個Django工程中多數情況下會存在多個應用, 如何針對多個應用的url進行配置呢,有以下兩種方案: 1、在Django工程的urls.py中針對每個應用分別配置不同的url路徑 2、在工程總體的urls.py中引入每個應用的url配置檔案,不
Struts2之動態方法呼叫(優點:呼叫同一個action中的多個方法不需要在配置檔案中寫多個指向相同action類的的action節點只需要一個action節點就行)
在表單action值裡指定所呼叫的action中的哪個方法而不是藉助配置檔案action節點的method屬性 1 UserAction類 package org.action; import java.io.IOException; import javax.servle
怎麼在web.xml中配置一個對應多個
<filter> <filter-name>loginFilter2</filter-name> <filter-class>de.base.LoginFilter</filter-class>
電腦中安裝多個Tomcat,如何配置(已經解決)
當電腦中已經有一個Tomcat時,由於不同的專案需要,所支援的Tomcat的版本不同,因此一個電腦中需要安裝多個Tomcat,接下來介紹怎樣安裝多個Tomcat的具體實現: 安裝前
AndroidStudio配置settings.gradle在工程中構建多個專案
諮詢,合作郵箱: [email protected] GitHub: https://github.com/DeMonLiu623 由於之前整理GitHub,刪除了一些專案,所以導致部分程式碼連結失效。如有需要,請留言,或者私信! 另外:由於CSDN的下載積分會
Struts中使用多個配置檔案 struts-config.xml
或許很多開發人員都面臨著這樣的困惑,那就是struct-config.xml檔案中有很多的配置,什麼action,formbean..... 我這裡說的100個action那是很小的專案了,呵呵,看得眼花繚亂,不利於模組化的開發和維護;解決的方法就是把struct-conf
log4j配置輸出到多個日誌文件
基準 方式 ref err logfile otl sni targe file 通常我們項目裏,有一些重要的日誌想單獨的輸出到指定的文件,而不是全總輸出到系統的日誌文件中。那麽我們log4j為我們提供了這種功能,以下我們來一步一步看是怎麽做的。這裏以pro
spring配置加載多個properties文件
lac 存在 cnblogs org bsp 讀取 ace val cati (一)首先,我們要先在spring配置文件中。定義一個專門讀取properties文件的類.例: 1 <bean id="propertyConfigurer" class="org.sp
log4j配置輸出到多個日誌文件(轉)
兩種模式 簡單 mylog 效果 evel ast mar 輸出 rop 參考資料:http://logging.apache.org/log4j/1.2/manual.html 通常我們項目裏,有一些重要的日誌想單獨的輸出到指定的文件,而不是全總輸出到系統的日誌文件中。那
Ubuntu16.04配置Apache支援多個站點
怎樣在一個Ubuntu的機器上(虛擬機器)配置Apache支援多個網站呢? 比如你有一臺獨立的Ubuntu虛擬機器,配有一個外網的IP(45.46.47.48),並且註冊了兩個域名AAA.com和BBB.com,將這兩個域名DNS解析到你虛機的IP地址。假設你已經安裝好了Apache,一
springboot中多個不同物件的屬性進行比較,將不同的值用使用陣列查詢出,並儲存在意向表中
多表維護 @MethodParameter(desc="orgTenantTypeQueryAll",input="user",postType={},postName="",queryString="",httpMethod="get",userParam="user
nginx 配置一個或者多個域名
nginx 配置一個或者多個域名 cd etc/nginx/ 進入到nginx目錄 vi nginx.conf server 一個為例 server { listen 80 default_server