W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
anyline-web默認(rèn)集成了ehcache作為一級(jí)緩存,在anyline-config.xml中通過(guò)IS_USE_CACHE開(kāi)啟。
同時(shí)需要添加ehcache的配置文件ehcache.xml,ehcache.xsd,并定義緩存空間
<cache name="static_1800"
maxElementsInMemory="10000"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="1800"
timeToLiveSeconds="1800"
memoryStoreEvictionPolicy="LFU" />
以上配置1800秒緩存時(shí)間
在AnylineService查詢時(shí)可以調(diào)用緩存
AnylineService.cache("static_1800","表","查詢條件");
AnylineService.cacheRow("static_1800","表","查詢條件");
cache方法不會(huì)等到1800秒后再刷新緩存,當(dāng)緩存時(shí)間達(dá)到90%的時(shí),此時(shí)再查詢cache將返回緩存數(shù)據(jù),同時(shí)執(zhí)行一次緩存刷新
AnylineService默認(rèn)集成了ehcache緩存、需要先在ehcache.xml中配置緩存
service.query("緩存key","表名","查詢條件")
與查詢數(shù)據(jù)庫(kù)參數(shù)一致
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: