将 javax.cache.CacheManager 与 EhCache 结合使用

发布于 2024-12-25 19:01:42 字数 367 浏览 3 评论 0 原文

我正在尝试使用 javax.cache.CacheManager JSR107 API,并使用 EhCache 作为缓存解决方案提供程序。但我无法找到任何此类资源。

根据 http://ehcache.org/documentation/integrations/jsr107 的链接,它说ehcache jsr107 仍处于草案阶段。任何人都可以确认情况是否仍然如此吗?

有任何使用 JSR107 javax.cache.* 类来使用 net sf cacheManager 的示例代码吗?

谢谢, 哈里什

I am trying to use javax.cache.CacheManager JSR107 API using EhCache as caching solutioarin provider. But I am unable to find any such resources.

As per the link at http://ehcache.org/documentation/integrations/jsr107 , it says that ehcache jsr107 is still in draft phase. Can any one please confirm if it's still the case?

Any sample code to use net sf cacheManager using JSR107 javax.cache.* classes?

Thanks,
Harish

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遗忘曾经 2025-01-01 19:01:42

此页面

由于JCACHE尚未发布Ehcache的JCACHE API
实现已作为 net.sf.jsr107cache 发布。

您可以在 Github 存储库中找到这项工作。如果您看到 JCacheManager 实现 javax.cache.CacheManager

As specified in this page:

Because JCACHE has not yet been released the JCACHE API that Ehcache
implements has been released as net.sf.jsr107cache.

This effort can be found in the Github repository. If you see JCacheManager implements javax.cache.CacheManager

最后的乘客 2025-01-01 19:01:42

现在 API 已经最终确定,这是一个更好的答案。把这个放在你的 pom 中:

     <dependency>
        <groupId>org.ehcache</groupId>
        <artifactId>jcache</artifactId>
        <version>1.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.jsr107.ri</groupId>
        <artifactId>cache-annotations-ri-guice</artifactId>
        <version>1.0.0</version>
    </dependency>

然后你就出发了。使用任何这样的注释进行注释:(祝你好运找到 javadocs!)

@CacheResult(cacheName = "monthly")
public List<QueryResult> monthly(String prefix) {
    //...
}

不过我同意,文档很糟糕。

这是 更多 javax.cache 信息

Here's a better answer now the API is finalised. Stick this in your pom:

     <dependency>
        <groupId>org.ehcache</groupId>
        <artifactId>jcache</artifactId>
        <version>1.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.jsr107.ri</groupId>
        <artifactId>cache-annotations-ri-guice</artifactId>
        <version>1.0.0</version>
    </dependency>

And you're off. Annotate with any of the annotations like this: (good luck finding the javadocs!)

@CacheResult(cacheName = "monthly")
public List<QueryResult> monthly(String prefix) {
    //...
}

I agree though, the documentation sucks.

Here's more javax.cache info if you're interested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文