java - weblogic 上的 java 自定义缓存重新加载

标签 java spring caching weblogic11g

我需要通过从数据库读取 xml 来缓存 xml bean java 对象。我在内存中使用 HashMap 来维护我的 java 对象。我使用 spring 作为 DI 和 Weblogic 11g 应用服务器。

您能否建议我一种在 xml 文件中有更新时重新加载缓存的机制。

最佳答案

您可以使用 weblogic p13n 缓存来实现此目的,而不是使用您自己的 HashMap 来缓存 java 对象。您必须配置 p13n-cache-config.xml 文件,其中包含缓存的 TTL、最大值等。

来到第一点,TTL时间结束后缓存会自动重新加载。对于手动清除缓存,您可以实现 Servlet 之类的东西,您可以直接从浏览器访问它(可以将其限制为特定 URL)。在该 servlet 中清除您要重新加载的缓存。

weblogic p13n 缓存还为您提供了集群感知缓存清除的方法,如果您需要它,如果您想使用自己的 HashMap 进行缓存,请为该 HashMap 提供更新方法并清除您想要的 java 对象重新加载,然后调用缓存创建方法。

关于java - weblogic 上的 java 自定义缓存重新加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8050451/

相关文章:

css - Spring 启动 : Adding static content to web application

c++ - 虚假分享会导致错误的结果吗?

java.lang.NoClassDefFoundError : javax/xml/bind/DatatypeConverter while decoding JWT token with Java 11

Java Spring Boot 为 FasterXml Jackson 库应用配置

java - ConcurrentSkipListMap put 方法是线程安全的吗?

java - onActivityResult 中的 View 为空

java - 你如何使@Resource 成为可选的?

java - Spring-RMI 事件导致 java.io.InvalidClassException : filter status: REJECTED

java - Spring 3.1.1 和缓存配置问题

caching - Umbraco 不会从缓存中清除损坏的代码