`
slqprrx
  • 浏览: 12109 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ehcache2.5的源码分析 ---- 缓存失效机制

阅读更多
2.5的算法变了,清超出的缓存的代码在这里:

net.sf.ehcache.store.chm.SelectableConcurrentHashMap
第五百行

int runs = Math.min(MAX_EVICTION, SelectableConcurrentHashMap.this.quickSize() - (int) SelectableConcurrentHashMap.this.maxSize);
                        while (runs-- > 0) {
                            Element evict = nextExpiredOrToEvict(value);
                            if (evict != null) {
                                evicted[runs] = (remove(evict.getKey(), hash(evict.getKey().hashCode()), null));
                            }
                        }


net.sf.ehcache.store.MemoryStore

private void checkCapacity(final Element elementJustAdded) {
        if (maximumSize > 0 && !isClockEviction()) {
            int evict = Math.min(map.quickSize() - maximumSize, MAX_EVICTION_RATIO);
            for (int i = 0; i < evict; i++) {
                removeElementChosenByEvictionPolicy(elementJustAdded);
            }
        }
    }
其实外国人写的代码也就那样,也很乱。
分享到:
评论

相关推荐

    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 3(ehcache-clustered-3.8.1-kit.zip)

    在"ehcache-clustered-3.8.1-kit.zip"这个压缩包中,我们重点关注的是Ehcache的集群支持版本,这使得多个节点能够协同工作,共享和同步缓存数据,从而提高系统的可扩展性和可用性。 Ehcache 3 的核心概念包括缓存...

    ehcache.rar ehcache-core-2.6.10.jar依赖包

    ehcache-core-2.6.10.jar依赖包 MyBatiesEhCache二级缓存 Ehcache是一种广泛使用的开源Java分布式缓存。主要面向通用缓存,Java EE和轻量级容器。它具有内存和磁盘存储,缓存加载器,缓存扩展,缓存异常处理程序,一个...

    ehcache1.6 和 ehcache-web-2.0.4

    8. **Web会话缓存**: Ehcache-web插件通过拦截Servlet请求,实现会话的缓存。配置完成后,Web应用的会话状态会被自动缓存,降低服务器资源消耗。 9. **缓存更新策略**: Ehcache支持缓存穿透(缓存不存在的请求)、...

    ehcache.jar及源码

    总之,Ehcache是一个强大的缓存解决方案,通过`ehcache-core-2.5.2.jar`和`ehcache-core-2.5.2-sources.jar`这两个文件,开发者不仅可以使用Ehcache提供的高效缓存服务,还能深入了解其内部机制,进行定制和优化,...

    Mybatis-ehcache 1.2.1源码(ehcache-cache-mybatis-ehcache-1.2.1.zip)

    通过阅读源码,我们可以深入理解Mybatis-ehcache如何利用Ehcache实现缓存功能,以及它如何与Mybatis的运行机制无缝对接。这不仅有助于我们定制自己的缓存解决方案,还能帮助我们在实际项目中更高效地使用Mybatis和...

    Mybatis-ehcache 1.2.1源码(ehcache-cache-mybatis-ehcache-1.2.1.tar

    5. **缓存刷新**:当数据库中的数据发生变化时,Mybatis-ehcache 会通过监听机制或者定时任务来刷新对应的缓存,确保缓存与数据库数据的一致性。 6. **异常处理**:源码中包含了异常处理逻辑,当缓存操作出现问题时...

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

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

    ehcache缓存jar(ehcache-core-2.4.6.jar+ehcache-web-2.0.4.jar)

    ehcache缓存jar(ehcache-core-2.4.6.jar+ehcache-web-2.0.4.jar)

    ehcache2-7-3 源码

    源码分析可以帮助我们深入了解其内部机制,优化使用,并为自定义扩展提供基础。在Ehcache 2.7.3版本中,我们可以从源码中学习以下几个关键知识点: 1. **缓存管理**:Ehcache的核心功能是管理缓存项,包括存储、...

    ehcache-web-2.0.4-API文档-中文版.zip

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

    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-core-2.6.11-API文档-中文版.zip

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

    shiro-ehcache-1.4.0-API文档-中文版.zip

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

    Ehcache 2.10.8(bigmemory-max-4.3.8.4.2.tar.gz)

    Ehcache是一款广泛使用的开源Java缓存解决方案,它允许开发者在应用程序中添加高效的缓存机制,从而提升性能和响应速度。Ehcache 2.10.8是该产品的特定版本,它包含了针对缓存管理和优化的一系列特性和改进。在...

    ehcache-core-2.6.2-distribution.tar

    4. 文件"ehcache-core-2.6.2"分析: 这个压缩包很可能是EhCache 2.6.2版本的核心库,包含了EhCache运行所需的所有类和资源。开发者通常会将这个库导入项目中,以便在应用程序中使用EhCache的功能。压缩包可能包含...

    ehcache-spring-annotations-1.2.0.jar

    ehcache-spring-annotations-1.2.0.jar

    ehcache-spring-annotations-1.2.0

    ehcache-spring-annotatios是获得Apache认证的...2.0版本实现缓存的技术,1.1.2版本的ehcache-spring-annotations刚刚发布不久,在本文中,我将会介绍如何在一个web工程时使用ehcache-spring-annotations实现缓存机制。

    ehcache-2.5.1-distribution.tar.gz最新下载

    `ehcache-2.5.1-distribution.tar.gz`是Ehcache 2.5.1版本的发行版压缩包,通常包含了Ehcache库的所有组件和相关文档。 在Ehcache 2.5.1版本中,你可以找到以下关键知识点: 1. **核心概念**:Ehcache的核心包括...

    ehcache-spring-annotations-1.1.2.jar

    ehcache-spring-annotations-1.1.2.jar

Global site tag (gtag.js) - Google Analytics