Tapestry 组件缓存
我的 Web 应用程序中有一个为每个页面呈现的组件(菜单),它没有用,而且占用资源。
有没有办法在这个组件上放置一个缓存,以便缓存它的 HTML 输出?
注意:我已经使用 EhCache,也许有办法连接它们?
I have a component in my web application (the menu) that is rendered for every page, and it's useless and takes up resources.
Is there a way to put a cache on this component, so that its HTML output is cached?
Note: I already use EhCache, maybe there's a way to interface them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看一下:
IOKO 缓存
看起来不错,即使我希望有更大的灵活性固定在 Enum (CacheRegion) 上的缓存名称
Have a look at :
IOKO cache
Looks nice, even if I wished more flexibility to the cache names which are stuck to an Enum (CacheRegion)
除非您的组件执行一些数据库访问或其他繁重的工作,否则缓存它是没有意义的;这只是过早的优化。此外,最好缓存组件使用的数据,而不是尝试缓存组件的输出。
Unless your component does some database access or other heavy work, there's no point in caching it; it would just be premature optimizations. Further, its best to cache the data used by the component, rather than attempting to cache the output of the component.
如果此应用处于极端负载下,您可能需要考虑使用边缘侧包含。使用诸如 Varnish 之类的缓存代理,您可以缓存页面的片段,这样就不必重新生成每个请求的页面的这些部分。 本文对此过程有很好的解释。
If this app is under extreme load you might want to consider using edge side includes. With a caching proxy such as Varnish you can then cache fragments of a page so that you won't have to regenerate those parts of the page on each request. There's a good explanation of the process in this article.
我工作的公司创建了一个 Tapestry 缓存 扩展来执行此操作。我已经有一段时间没有使用它了,但是过去几年我们在一些相当大的网站上使用了它,并给了我们一些很好的结果。
The company I work for created a Tapestry cache extension to do this. I haven't used in a while, but we used it on some quite big sites in the last few years and gave us some good results.