简体   繁体   English

Ruby on Rails-跨请求的全局变量持久性

[英]Ruby on Rails - global variable persistence across requests

In a RoR application, I would like to load a set of key/values from db into a global variable which persists across requests and clear the variable as and when I need. 在RoR应用程序中,我想将一组键/值从db加载到全局变量中,该变量在请求中持久存在,并在需要时清除该变量。 My application runs in a WAS cluster. 我的应用程序在WAS集群中运行。 I tried a few things. 我尝试了几件事。 1. Used memcachestore and read/write/clear as needed. 1.根据需要使用memcachestore和读取/写入/清除。 2. Load the key/values in a yaml file and clear it when required. 2.将键/值加载到yaml文件中,并在需要时将其清除。 Please let me know if I could do it differently.Thanks. 请让我知道是否可以做不同的事情。谢谢。

我们是否没有可以存储所需对象的Flash和会话散列?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM