欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

resty的緩存技術(shù)設(shè)計(jì)及使用

 更新時間:2022年03月07日 15:48:01   作者:Dreampie  
這篇文章主要為大家介紹了resty緩存技術(shù)的設(shè)計(jì)及使用示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步

resty的緩存設(shè)計(jì)極其簡單,目前分為兩部分,model數(shù)據(jù)緩存和session緩存,第3條使用權(quán)限控制時,session被存入緩存,便于實(shí)現(xiàn)分布式,支持 ehcache和 redis

1. 在application.properties里啟用緩存,并配置緩存對象

app.cacheEnabled=true
#如果不配置cacheManager對象,默認(rèn)使用ehcacheManager
#app.cacheManager=cn.dreampie.cache.redis.RedisManager

2. 在resources下配置緩存文件

ehcache.xml

<ehcache name="shiro" updateCheck="false" monitoring="autodetect"
         dynamicConfig="true">
  <diskStore path="java.io.tmpdir/resty-ehcache"/>

  <defaultCache
      maxElementsInMemory="10000"
      eternal="false"
      timeToIdleSeconds="360"
      timeToLiveSeconds="360"
      overflowToDisk="false"
      diskPersistent="false"
      diskExpiryThreadIntervalSeconds="120"/>

  <cache name="_credential"
         maxElementsInMemory="10000"
         eternal="false"
         timeToIdleSeconds="1200"
         overflowToDisk="false"
         diskPersistent="false"
         diskExpiryThreadIntervalSeconds="120"/>

  <!--session 緩存永久的 程序自動清理過期的數(shù)據(jù)-->
  <cache name="_session"
         maxElementsInMemory="10000"
         eternal="true"
         overflowToDisk="true"
         diskPersistent="true"
         diskExpiryThreadIntervalSeconds="120"/>

</ehcache>

redis.properties

redis.host=127.0.0.1:6379
#如果使用ShardInfo 逗號分割
#redis.shard.host=127.0.0.1:6379,127.0.0.1:6379
redis.timeout=0
redis.pool.maxWaitMillis=-1
redis.pool.minEvictableIdleTimeMillis=1800000

3. 在Model的table配置中,Record的構(gòu)造參數(shù)開啟緩存

//model
@Table(name = "sec_user",generatedKey="id", primaryKey = "sid", cached = true)
//record
Record recordDAO = new Record("sec_user", true);

以上就是resty的緩存技術(shù)設(shè)計(jì)及使用的詳細(xì)內(nèi)容,更多關(guān)于resty緩存設(shè)計(jì)使用的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論