热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何在Rails中禁用数据库查询缓存以提高性能和数据一致性

Ihaveadropdownmenuwhereitscontentsisfromthedatabasetabletypes.我有一个下拉菜单,其内容来自数据库表类型。

I have a drop down menu where its contents is from the database table types.

我有一个下拉菜单,其内容来自数据库表类型。

But every time I insert a new entry into the types table, the drop down menu is not updated, I suspect the database caching is turned on that prevents this from updating.

但是每次我在types表中插入一个新条目时,下拉菜单都不会更新,我怀疑数据库缓存已打开,这会阻止更新。

Is there a way to turn off the caching so that it can reflect the changes in the database immediately?

有没有办法关闭缓存,以便它可以立即反映数据库中的更改?

thank you.

谢谢。

1 个解决方案

#1


0  

you can always use the method .reload to assure that you are using the last version of your object (up to the call of .reload, of course)

你总是可以使用方法.reload来确保你使用的是对象的最后一个版本(当然是.reload的调用)


推荐阅读
author-avatar
手机用户2502933677
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有