开发者

global variable problem with rails+apache passenger

开发者 https://www.devze.com 2023-03-14 09:25 出处:网络
In my application I set a global variable in application controller, In my development machine it works fine and variable is referred accross the application.

In my application I set a global variable in application controller,

In my development machine it works fine and variable is referred accross the application.

But in the production server (Apache passenger), when I change the global variable value through 开发者_开发知识库the application, it updates the table but, it doesn't reflect in the application. Every time I have to restart the server to get the global variable changed.

Please advise me where to set the global variable, so that I change the value of global variable from my application.

Thanks


The production Apache server will be using multiple processes and each process will have its own version of your application. Setting your global variable in one process won't affect the variable's value in any of the other processes.

If you need to share some information across instances, you'll have to store it in a database or similar common data store that is shared by all your server processes.

0

精彩评论

暂无评论...
验证码 换一张
取 消