Grails 用户域类和缓存 true
什么时候应该使用以下内容?
static mapping = {
cache true
}
我很想将它添加到我的域类 User、UserRole 和 Role 中。
When should one use the following?
static mapping = {
cache true
}
I am tempted to add it to my domain classes User, UserRole and Role.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在分析您的应用程序并确定缓存信息(例如您的域类)将使您的应用程序受益之后,您应该进行缓存。只读或很少更改的数据只要具有高使用率就应该考虑缓存。
关键是,分析您的应用程序,然后才计划在有意义的地方进行缓存。不要仅仅因为您可以使用而进行缓存。
You should cache after you have profiled your application and determined that caching information (such as your domain classes) would benefit your application. Data that is read only or changed very rarely should be considered for cache as long as it has a high usage.
The key is, profile your application, and only after that plan for caching where it makes sense. Don't just cache because it's available to you.