`
sjsky
  • 浏览: 918238 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

EhCache之初试

阅读更多

   blog迁移至 :http://www.micmiu.com

 

EhCache 是一个纯Java的进程内缓存框架,具有快速、精干等特点,是Hibernate中默认的CacheProvider。

 

详情参见其官网站:http://ehcache.org/  

具体文件下载网站:http://sourceforge.net/projects/ehcache/files/

 

下面将用实际的Demo分类演示介绍EhCache的初步使用:

  • 单例CacheManager 创建
  • 多个CacheManager 创建
  • Cache的多种创建方式
  • 对Cache的CRUD的操作
  • Cache的统计信息
  • 测试所用两个的ehcache.xml文件

[一]、单例CacheManager 创建

      1.代码示例:

 /**
     * @blog http://sjsky.iteye.com <br>
     *       单例CacheManager 创建
     */
    public static void testCreateSingleton() {
        // Create a singleton CacheManager using defaults
        System.out.println("Create a singleton CacheManager using defaults");
        // CacheManager.create();
        System.out.println("CacheManager.create()     :="
                + CacheManager.getInstance());
        System.out.println("cacheNames length := "
                + CacheManager.getInstance().getCacheNames().length);
        CacheManager.getInstance().shutdown();

        System.out.println("=======================================");

        // Create a singleton CacheManager using a configuration file
        System.out
                .println("Create a singleton CacheManager using a configuration file");
        CacheManager singletonManager2 = CacheManager
                .create("src/main/java/michael/hibernate/cache/ehcache/ehcache.xml");
        System.out.println("CacheManager.create(file) :=" + singletonManager2);
        System.out.println("cacheNames length := "
                + singletonManager2.getCacheNames().length);
        System.out
                .println("CacheManager.getInstance() == singletonManager2 :: "
                        + (CacheManager.getInstance() == singletonManager2));
        singletonManager2.shutdown();
        // CacheManager.getInstance().shutdown();

        System.out.println("=======================================");

        // Create a singleton CacheManager from a configuration resource in the
        // classpath.
        URL configurl = Thread.currentThread().getContextClassLoader()
                .getResource("michael/hibernate/cache/ehcache/ehcache.xml");
        CacheManager singletonManager3 = CacheManager.create(configurl);
        System.out.println("CacheManager.create(url)  :=" + singletonManager3);

        String[] cacheNames = singletonManager3.getCacheNames();
        System.out.println("cacheNames length := " + cacheNames.length);
        for (String name : cacheNames) {
            System.out.println("name := " + name);
        }
        singletonManager3.shutdown();
        // CacheManager.getInstance().shutdown();
    }
 

      2.运行结果:

Create a singleton CacheManager using defaults
CacheManager.create() :=net.sf.ehcache.CacheManager@e80842
cacheNames length := 4
=======================================
Create a singleton CacheManager using a configuration file
CacheManager.create(file) :=net.sf.ehcache.CacheManager@1bbf1ca
cacheNames length := 6
CacheManager.getInstance() == singletonManager2 :: true
=======================================
CacheManager.create(url) :=net.sf.ehcache.CacheManager@f9c40
cacheNames length := 6
name := sampleRepicatedCache2
name := sampleReplicatedCache1
name := sampleCache2
name := sampleCache1
name := sampleReplicatedCache3
name := sampleCache3

 

[二]、多个CacheManager 创建

      1.代码示例:

/**
     * @blog http://sjsky.iteye.com <br>
     *       CacheManager 创建
     */
    public static void testCreateManager() {

        // Create a CacheManager instance using defaults
        CacheManager manager1 = new CacheManager();
        System.out.println("new CacheManager()     := " + manager1);
        String[] cacheNames = manager1.getCacheNames();
        System.out.println("cacheNames length := " + cacheNames.length);
        for (String name : cacheNames) {
            System.out.println("name := " + name);
        }
        manager1.shutdown();

        System.out.println("=======================================");

        // Create a CacheManager instance using a configuration file
        CacheManager manager2 = new CacheManager(
                "src/main/java/michael/hibernate/cache/ehcache/ehcache.xml");
        System.out.println("new CacheManager(file) := " + manager2);
        System.out.println("cacheNames length := "
                + manager2.getCacheNames().length);
        manager2.shutdown();

        System.out.println("=======================================");
        // Create a singleton CacheManager from a configuration resource in the
        // classpath.
        URL configurl = Thread.currentThread().getContextClassLoader()
                .getResource("michael/hibernate/cache/ehcache/ehcache.xml");
        CacheManager manager3 = new CacheManager(configurl);
        System.out.println("new CacheManager(url)  := " + manager3);
        System.out.println("cacheNames length := "
                + manager3.getCacheNames().length);
        for (String name : manager3.getCacheNames()) {
            System.out.println("name := " + name);
        }
        manager3.shutdown();

    }
 

      2.运行结果:

new CacheManager() := net.sf.ehcache.CacheManager@17653ae
cacheNames length := 4
name := sampleCache2
name := org.hibernate.cache.UpdateTimestampsCache
name := sampleCache1
name := org.hibernate.cache.StandardQueryCache
=======================================
new CacheManager(file) := net.sf.ehcache.CacheManager@1ff0dde
cacheNames length := 6
=======================================
new CacheManager(url) := net.sf.ehcache.CacheManager@db4fa2
cacheNames length := 6
name := sampleRepicatedCache2
name := sampleReplicatedCache1
name := sampleCache2
name := sampleCache1
name := sampleReplicatedCache3
name := sampleCache3
 

[三]、Cache的多种创建方式

      1.代码示例: 

    /**
     * @blog http://sjsky.iteye.com <br>
     *       Create Cache
     */
    public static void testCreateCache() {

        System.out.println("add cache with defaults:");
        CacheManager singletonManager = CacheManager.create();
        singletonManager.addCache("myCache1");
        Cache myCache1 = singletonManager.getCache("myCache1");
        System.out.println(myCache1);

        System.out.println("add cache with new Cache(arg1,arg2...):");
        Cache myMemoryCache = new Cache("myMemoryCache", 5000, false, false, 5,
                2);
        singletonManager.addCache(myMemoryCache);
        System.out.println(singletonManager.getCache("myMemoryCache"));

        System.out.println("Create a Cache specifying its configuration:");
        // Create a Cache specifying its configuration.
        int maxElements = 100;
        Cache myConfigCahce = new Cache(new CacheConfiguration("myConifgCahce",
                maxElements).memoryStoreEvictionPolicy(
                MemoryStoreEvictionPolicy.LFU).overflowToDisk(true).eternal(
                false).timeToLiveSeconds(60).timeToIdleSeconds(30)
                .diskPersistent(false).diskExpiryThreadIntervalSeconds(0));
        singletonManager.addCache(myConfigCahce);
        System.out.println(singletonManager.getCache("myConifgCahce"));

        singletonManager.shutdown();

    }
 

      2.运行结果:

add cache with defaults:
[ name = myCache1 status = STATUS_ALIVE eternal = false overflowToDisk = true maxElementsInMemory = 100 maxElementsOnDisk = 100 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 120 timeToIdleSeconds = 120 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: net.sf.ehcache.statistics.LiveCacheStatisticsWrapper hitCount = 0 memoryStoreHitCount = 0 diskStoreHitCount = 0 missCountNotFound = 0 missCountExpired = 0 overflowToOffHeap = false maxMemoryOffHeap = null ]
add cache with new Cache(arg1,arg2...):
[ name = myMemoryCache status = STATUS_ALIVE eternal = false overflowToDisk = false maxElementsInMemory = 5000 maxElementsOnDisk = 0 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 5 timeToIdleSeconds = 2 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: net.sf.ehcache.statistics.LiveCacheStatisticsWrapper hitCount = 0 memoryStoreHitCount = 0 diskStoreHitCount = 0 missCountNotFound = 0 missCountExpired = 0 overflowToOffHeap = false maxMemoryOffHeap = null ]
Create a Cache specifying its configuration:
[ name = myConifgCahce status = STATUS_ALIVE eternal = false overflowToDisk = true maxElementsInMemory = 100 maxElementsOnDisk = 0 memoryStoreEvictionPolicy = LFU timeToLiveSeconds = 60 timeToIdleSeconds = 30 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: net.sf.ehcache.statistics.LiveCacheStatisticsWrapper hitCount = 0 memoryStoreHitCount = 0 diskStoreHitCount = 0 missCountNotFound = 0 missCountExpired = 0 overflowToOffHeap = false maxMemoryOffHeap = null ]
 

 

[四]、对Cache的CRUD的操作

      1.代码示例:

   /**
     * @blog http://sjsky.iteye.com <br>
     *       CRUD operations
     */
    public static void testCacheElementCRUD() {
        CacheManager manager = null;
        try {
            manager = new CacheManager();
            manager.addCache("MichaelInfo");

            Cache myCache = manager.getCache("MichaelInfo");
            System.out.println("manager.getCache :" + myCache);

            Element element = new Element("blog", "http://sjsky.javaeye.com");
            myCache.put(element);
            System.out.println("cache put Element");
            System.out.println("get Element value:= "
                    + myCache.get("blog").getValue());
            System.out.println("get Element objectvalue:= "
                    + myCache.get("blog").getObjectValue());

            System.out.println("update the Element");
            myCache.put(new Element("blog", "http://sjsky.iteye.com"));
            System.out.println("get Element value:= "
                    + myCache.get("blog").getValue());
            System.out.println("get Element objectvalue:= "
                    + myCache.get("blog").getObjectValue());

            myCache.put(new Element("array", new String[] { "test", "array" }));
            System.out.println("array value:= "
                    + myCache.get("array").getValue());
            myCache.remove("array");
            if (null == myCache.get("array")) {
                System.out.println("remove Element 'array' successful.");
            }
        } catch (Exception e) {
            e.printStackTrace(System.out);
        } finally {
            if (null != manager) {
                manager.shutdown();
            }
        }
    }
 

      2.运行结果:

 

manager.getCache :[ name = MichaelInfo status = STATUS_ALIVE eternal = false overflowToDisk = true maxElementsInMemory = 100 maxElementsOnDisk = 100 memoryStoreEvictionPolicy = LRU timeToLiveSeconds = 120 timeToIdleSeconds = 120 diskPersistent = false diskExpiryThreadIntervalSeconds = 120 cacheEventListeners: net.sf.ehcache.statistics.LiveCacheStatisticsWrapper hitCount = 0 memoryStoreHitCount = 0 diskStoreHitCount = 0 missCountNotFound = 0 missCountExpired = 0 overflowToOffHeap = false maxMemoryOffHeap = null ]
cache put Element
get Element value:= http://sjsky.javaeye.com
get Element objectvalue:= http://sjsky.javaeye.com
update the Element
get Element value:= http://sjsky.iteye.com
get Element objectvalue:= http://sjsky.iteye.com
array value:= [Ljava.lang.String;@ec4a87
remove Element 'array' successful.
 

 

[五]、Cache的统计信息

      1.代码示例:

    /**
     * @blog http://sjsky.iteye.com <br>
     *       cache 信息统计
     */
    public static void testCacheStatistics() {
        CacheManager manager = null;
        try {
            manager = new CacheManager();
            manager.addCache("MichaelInfo");

            Cache myCache = manager.getCache("MichaelInfo");

            myCache.put(new Element("username", "Michael"));
            myCache.put(new Element("sex", "男"));
            myCache.put(new Element("date", new Date()));
            myCache.put(new Element("height", 172));
            myCache.put(new Element("position", "cto"));
            myCache.put(new Element("blog", "http://sjsky.iteye.com"));

            System.out.println("cache size := " + myCache.getSize());
            System.out.println("MemoryStoreSize := "
                    + myCache.getMemoryStoreSize());
            System.out
                    .println("DiskStoreSize := " + myCache.getDiskStoreSize());

            myCache.getStatistics().getDiskStoreObjectCount();
            System.out.println("Caceh getStatistics:");
            Statistics statistics = myCache.getStatistics();
            System.out.println("CacheHits := " + statistics.getCacheHits());
            System.out.println("CacheMisses := " + statistics.getCacheMisses());
            System.out.println("InMemoryHits := "
                    + statistics.getInMemoryHits());
            System.out.println("InMemoryMisses := "
                    + statistics.getInMemoryMisses());
            System.out.println("OnDiskHits := " + statistics.getOnDiskHits());
            System.out.println("OnDiskMisses := "
                    + statistics.getOnDiskMisses());
            System.out.println("MemoryStoreObjectCount := "
                    + statistics.getMemoryStoreObjectCount());
            System.out.println("DiskStoreObjectCount := "
                    + statistics.getDiskStoreObjectCount());

            Element element = myCache.get("username");
            System.out.println("Element HitCount := " + element.getHitCount());

        } catch (Exception e) {
            e.printStackTrace(System.out);
        } finally {
            if (null != manager) {
                manager.shutdown();
            }
        }
    }
 

      2.运行结果:

cache size := 6
MemoryStoreSize := 6
DiskStoreSize := 0
Caceh getStatistics:
CacheHits := 0
CacheMisses := 0
InMemoryHits := 0
InMemoryMisses := 0
OnDiskHits := 0
OnDiskMisses := 0
MemoryStoreObjectCount := 6
DiskStoreObjectCount := 0
Element HitCount := 1

 

[六]、测试所用两个的ehcache.xml文件

 

      1.classpath 下的: ehcache.xml (默认加载的配置文件)

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd"
         updateCheck="true" monitoring="autodetect"
         dynamicConfig="true">

    <diskStore path="java.io.tmpdir"/>

    <transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup"
                              properties="jndiName=java:/TransactionManager" propertySeparator=";"/>

    <cacheManagerEventListenerFactory class="" properties=""/>

    <defaultCache
            maxElementsInMemory="100"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="30"
            maxElementsOnDisk="100"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            statistics="false"
            />

    <cache name="org.hibernate.cache.StandardQueryCache"
    	maxElementsInMemory="5" 
    	eternal="false" 
    	timeToLiveSeconds="120"
    	overflowToDisk="true" />

    <cache name="org.hibernate.cache.UpdateTimestampsCache"
    	maxElementsInMemory="5000" 
    	eternal="true" 
    	overflowToDisk="true" />

    <cache name="sampleCache1"
           maxElementsInMemory="10000"
           maxElementsOnDisk="1000"
           eternal="false"
           overflowToDisk="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="300"
           timeToLiveSeconds="600"
           memoryStoreEvictionPolicy="LFU"
           transactionalMode="off"
            />

    <cache name="sampleCache2"
           maxElementsInMemory="1000"
           eternal="true"
           overflowToDisk="false"
           memoryStoreEvictionPolicy="FIFO"
            />
</ehcache>
 

 

      2.michael/hibernate/cache/ehcache/ehcache.xml(指定的配置文件)

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd"
         updateCheck="true" monitoring="autodetect"
         dynamicConfig="true">

    <diskStore path="java.io.tmpdir"/>

    <transactionManagerLookup class="net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup"
                              properties="jndiName=java:/TransactionManager" propertySeparator=";"/>


    <cacheManagerEventListenerFactory class="" properties=""/>

    <cacheManagerPeerProviderFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
            properties="peerDiscovery=automatic,
                        multicastGroupAddress=230.0.0.1,
                        multicastGroupPort=4446, timeToLive=1"
            propertySeparator=","
            />
    <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>

   
    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="30"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            statistics="false"
            />
    <cache name="sampleCache1"
           maxElementsInMemory="10000"
           maxElementsOnDisk="1000"
           eternal="false"
           overflowToDisk="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="300"
           timeToLiveSeconds="600"
           memoryStoreEvictionPolicy="LFU"
           transactionalMode="off"
            />

    <cache name="sampleCache2"
           maxElementsInMemory="1000"
           eternal="true"
           overflowToDisk="false"
           memoryStoreEvictionPolicy="FIFO"
            />

    <cache name="sampleCache3"
           maxElementsInMemory="500"
           eternal="false"
           overflowToDisk="true"
           timeToIdleSeconds="300"
           timeToLiveSeconds="600"
           diskPersistent="true"
           diskExpiryThreadIntervalSeconds="1"
           memoryStoreEvictionPolicy="LFU"
            />

    <cache name="sampleReplicatedCache1"
           maxElementsInMemory="10"
           eternal="false"
           timeToIdleSeconds="100"
           timeToLiveSeconds="100"
           overflowToDisk="false">

        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
        <bootstrapCacheLoaderFactory
                class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
    </cache>

    <cache name="sampleRepicatedCache2"
           maxElementsInMemory="10"
           eternal="false"
           timeToIdleSeconds="100"
           timeToLiveSeconds="100"
           overflowToDisk="false">
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                properties="replicateAsynchronously=false, replicatePuts=false,
                            replicatePutsViaCopy=false, replicateUpdates=true,
                            replicateUpdatesViaCopy=true, replicateRemovals=false"/>
    </cache>

    <cache name="sampleReplicatedCache3"
           maxElementsInMemory="10"
           eternal="false"
           timeToIdleSeconds="100"
           timeToLiveSeconds="100"
           overflowToDisk="true">
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
                properties="asynchronousReplicationIntervalMillis=200"/>
    </cache>
</ehcache>
 

 

本文对EhCache的初步使用示例就讲到这,下面一节将讲一讲EhCache和Hibernate的集成应用示例:Hibernate+EhCache配置二级缓存的 (http://sjsky.iteye.com/blog/1312132)。

 

 

 

本文连接:http://sjsky.iteye.com/blog/1288257

 

 

 

转载请注明来自:Michael's blog @ http://sjsky.iteye.com



----------------------------- 分 ------------------------------ 隔 ------------------------------ 线 ------------------------------

 

 

 

2
1
分享到:
评论
4 楼 sjsky 2012-11-26  
lvwenwen 写道
哥们,麻烦把工程压缩共享下,谢谢了

不好意思哈,具体的工程找不到了,不过这就是几个测试的用的main方法,copy下就可以了
3 楼 lvwenwen 2012-11-26  
哥们,麻烦把工程压缩共享下,谢谢了
2 楼 sjsky 2011-12-02  
m635674608 写道
可以贴源码吗、、、???谢谢

这个就是示例的源码,
如果你是指ehcache.xml文件?那个就是官方的模版里的东西
1 楼 m635674608 2011-12-02  
可以贴源码吗、、、???谢谢

相关推荐

    ehcache监控工具ehcache-monitor-kit-1.0.3

    1.解压缩到目录下,复制ehcache-monitor-kit-1.0.0\lib\ehcache-probe-1.0.0.jar包到application的web-inf/lib目录下 2.将以下配置copy的ehcache.xml文件的ehcache标签中,注:上述链接中说的配置少写了个probe包名...

    ehcache.xsd_ehcache.xml代码提示.rar

    【标题解析】:“ehcache.xsd_ehcache.xml代码提示.rar”这个标题表明这是一个与Ehcache缓存系统相关的资源包,主要目的是为Ehcache的配置文件ehcache.xml提供代码提示功能。Ehcache是一个广泛使用的开源Java缓存...

    Ehcache 简单的监控

    Ehcache是一个开源的、高性能的缓存解决方案,广泛应用于Java应用程序中,以提高数据访问的速度和效率。本文将深入探讨Ehcache的简单监控,帮助开发者更好地理解其工作原理和性能状态。 首先,了解Ehcache的核心...

    ehcache-3.3.1-API文档-中文版.zip

    赠送jar包:ehcache-3.3.1.jar; 赠送原API文档:ehcache-3.3.1-javadoc.jar; 赠送源代码:ehcache-3.3.1-sources.jar; 赠送Maven依赖信息文件:ehcache-3.3.1.pom; 包含翻译后的API文档:ehcache-3.3.1-javadoc-...

    ehcache.jar及源码

    Ehcache是一个广泛使用的开源Java缓存库,它为应用程序提供了高效的内存管理和数据缓存功能。Ehcache的核心目标是提高应用性能,通过将频繁访问的数据存储在内存中,减少对数据库的依赖,从而降低系统负载。这次我们...

    ehcache

    **Ehcache 知识详解** Ehcache 是一个开源的、高性能的缓存解决方案,广泛应用于Java应用程序中,尤其在提升系统性能和减少数据库负载方面表现突出。它支持内存和磁盘存储,并且可以与Java持久层框架如Hibernate、...

    项目优化之Ehcache页面缓存

    Ehcache是一款高效、流行的Java缓存库,它在项目优化中扮演着重要角色,尤其在处理前端页面缓存方面。本文将深入探讨Ehcache的工作原理、优势、配置以及如何将其应用于页面缓存,同时结合提供的代码案例和文档,帮助...

    Ehcache分布式缓存与其在SpringBoot应用

    Ehcache是一个高性能的、基于Java的进程内缓存解决方案,它被广泛应用于各种Java应用程序,包括Java EE和轻量级容器。Ehcache的主要优势在于它的快速响应、易用性和丰富的缓存策略。它提供了两种级别的缓存存储:...

    hibernate+ehcache

    【标题】:“Hibernate + Ehcache 整合使用详解” 【描述】:“Hibernate 是一款流行的 Java 持久层框架,而 Ehcache 是一个高效的分布式内存缓存系统。将两者结合,能够极大地提升应用的性能,减少数据库的负载,...

    mybatis ehcache 1.0 ehcache.xsd 提示文件

    MyBatis通过集成Ehcache,实现了数据的二级缓存,即在SqlSession级别的一级缓存之上,增加了全局的二级缓存。 `ehcache.xsd`文件是Ehcache的XML Schema定义文件,它定义了Ehcache配置文件的结构和规则。当我们创建...

    ehcache2.6.5.rar

    Ehcache是一个开源的Java缓存库,广泛用于提高应用程序的性能和响应速度,通过存储经常访问的数据在内存中,避免了频繁的数据库查询。它最初由Tomi Triebel开发,现在是Terracotta公司的产品。在版本2.6.5中,...

    ehcache-3.9.9-API文档-中英对照版.zip

    赠送jar包:ehcache-3.9.9.jar; 赠送原API文档:ehcache-3.9.9-javadoc.jar; 赠送源代码:ehcache-3.9.9-sources.jar; 赠送Maven依赖信息文件:ehcache-3.9.9.pom; 包含翻译后的API文档:ehcache-3.9.9-javadoc-...

    ehcache资料(包含ehcache jar包)

    **Ehcache** 是一个广泛使用的Java缓存库,它为应用程序提供了本地内存缓存功能,以提高数据访问速度和减少数据库负载。Ehcache在处理高并发和大数据量的场景下表现出色,尤其适用于那些频繁读取但不经常修改的数据...

    Ehcache(一): Spring + Ehcache开场白

    Ehcache是一款高性能、易用且广泛应用于Java环境中的分布式缓存系统,它极大地提高了应用程序的性能和响应速度。在Spring框架中集成Ehcache,能够实现数据的快速访问,减轻数据库的压力,优化整体系统架构。本文将...

    EHcache相关jar下载及案例

    EHcache是一款广泛使用的开源Java分布式缓存系统,主要设计用于提高应用程序的性能和可伸缩性。在Java应用程序中,特别是那些基于Hibernate或MyBatis的持久层框架中,EHcache作为二级缓存工具,能够显著提升数据访问...

    ehcache的配置参数详解

    ehcache是一种广泛使用的Java缓存框架,用于提高应用程序性能,特别是在数据访问操作中。通过将数据存储在内存中,ehcache能够显著减少数据库查询次数,从而加快应用响应速度。本文将深入探讨ehcache.xml配置文件中...

    Ehcache 3(ehcache-clustered-3.8.1-kit.zip)

    Ehcache 3 是一个广泛使用的开源Java缓存解决方案,特别是在需要高性能、低延迟的数据存储和检索场景下。Ehcache 3 提供了丰富的功能,包括本地内存缓存、磁盘持久化、多线程支持以及在分布式环境中实现集群共享缓存...

    Ehcache_Hello

    **Ehcache简介** Ehcache是一款开源的Java缓存框架,它被广泛应用于提高应用程序性能,通过存储数据副本以减少对数据库的访问。Ehcache最初由Tomi Tirro设计,现在是Terracotta公司的产品,是Java世界中常用的二级...

    ehcache 的 xsd 文件

    ehcache 的 xsd 文件

    ehcache配置使用详解

    ### ehcache配置使用详解 #### 一、ehcache概述与特性 **背景介绍:** 缓存作为提升系统响应速度和降低数据库压力的关键技术,在现代软件架构中占据着重要位置。ehcache,作为一款高性能的开源Java缓存框架,旨在...

Global site tag (gtag.js) - Google Analytics