RESTEasy 是否有一个好的 BrowserCache 实现? (比 LightweightBrowserCache 更好)
我们使用 RESTEasy 2.2.3.GA 提供的 LightweightBrowserCache
,但注意到当达到缓存大小限制时,缓存会被完全清除。显然,这严重降低了缓存命中的机会,因为最常用的项目无法保留在缓存中。
我们希望创建一个更复杂的实现(例如基于 Ehcache),当达到大小限制时,它会驱逐最近最少使用的项目。
有谁知道我们可以使用 org.jboss.resteasy.client.cache.BrowserCache 的良好开源实现吗?
或者
您是否实现了自己的 org.jboss.resteasy.client.cache.BrowserCache ?如果是,您是否知道我们应该小心避免的任何问题?
We're using the LightweightBrowserCache
provided by RESTEasy 2.2.3.GA but have noticed that when the cache size limit is reached, the cache is cleared completely. Obviously this severely reduces the chance of cache hits, because there's no way that the most regularly used items can remain in the cache.
We'd like to create a more sophisticated implementation (e.g. based on Ehcache) that would evict the least recently used items when the size limit is reached.
Does anyone know of a good, open source implementation of org.jboss.resteasy.client.cache.BrowserCache
that we could use?
or
Have you implemented your own org.jboss.resteasy.client.cache.BrowserCache
and if so do you know of any gotchas we should be careful to avoid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们使用 Apache HTTP 客户端及其缓存组件以及 RestEasy 客户端框架来解决 LightweightBrowserCache 的这一限制。 RestEasy 允许与 Apache HTTP 客户端组件集成,详细信息可以在 RestEasy 文档中找到。
We have used Apache HTTP Client with its Caching component together with RestEasy Client Framework to get around this limitation of LightweightBrowserCache. RestEasy allows integrating with Apache HTTP Client Component, details can be found in RestEasy documentation.
您可以尝试使用 Resteasy 默认缓存技术。
依赖项:
代码更改:在应用程序类中为 ServerCacheFeature 添加单例。
将此注释添加到您的函数中:
You can try with Resteasy default caching technique.
Dependency :
Code Changes : Add singleton for ServerCacheFeature in your application class.
Add this annotation to your function :