b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

ehcache aop_ehcache与spring整合_ehcache使用(4)

电脑杂谈  发布时间:2017-01-12 01:04:12  来源:网络整理

Cache cache = manager.getCache("sampleCache");

cache.disableDynamicFeatures();

23.2.5之前是通过元素的个数来表示内存或者硬盘的大小;2.5之后,通过字节数来表示。2.5暂时还没有出来。新属性将会是:

The new cache attributes are:

• maxBytesOnHeap

• maxBytesOffHeap (formerly maxMemoryOffHeap)

• maxBytesOnDisk

甚至,还可以指定比例,如:maxBytesOnHeap="20%".

24.Ehcache可以将一些数据一直放到缓存或者堆栈或者硬盘或者terracotta的L2中。主要是为了满足Hibernate等一些情况下的需求。但是,这样很容易造成内存溢出的错误

25.当缓存刚启动时,ehcache提供一个机制可以先加载数据:BootstrapCacheLoader

class="net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory"

properties="bootstrapAsynchronously=true"/>

DiskStoreBootstrapCacheLoaderFactory:从硬盘加载数据到堆栈

class="net.sf.ehcache.store.DiskStoreBootstrapCacheLoaderFactory"

properties="bootstrapAsynchronously=true"/>

TerracottaBootstrapCacheLoaderFactory:从terracotta的L2中加载数据

class="net.sf.ehcache.store.TerracottaStoreBootstrapCacheLoaderFactory"

properties="bootstrapAsynchronously=true"/>

26.可以配置ehcache在读或者写的时候,做些事情。

CacheConfiguration config = new CacheConfiguration("copyCache", 1000).copyOnRead(true)

Cache copyCache = new Cache(config);

默认此属性是false。

maxElementsInMemory="10"

eternal="false"

timeToIdleSeconds="5"

timeToLiveSeconds="10"

overflowToDisk="false"

copyOnRead="true"

copyOnWrite="true">

com.company.ehcache.MyCopyStrategy"/>

27.每一个cache都有一个copyStrategy,所以,该实现是要求线程安全的

在ehcache启动的时候,可以设置缓存失效。命令行启动的时候如下:

java -Dnet.sf.ehcache.disabled=true

其他特殊的系统属性:

1)java -Dnet.sf.ehcache.use.classic.lru=true

当LRU被选中的时候,更老的LruMemoryStore实现策略将会被真正采用

28.ehcache.xml必须遵守ehcache.xsd文件中的要求


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-25689-4.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 相叶弘树
      相叶弘树

    • 平井坚
      平井坚

      一切爱好和平与尊重他国领土主权的国家

    • 李敏
      李敏

      全民屏住那口气直到民族必须一战时一举打趴日本军国主义才是可以高调时

    每日福利
    热点图片
    拼命载入中...