Whats the best way to store a Global/Class Variable in Rails thats updated through a dashboard? -


i need store global/class variable updated managers web dashboard. variable array, lets call car_types. once week managers need go in , change value. maybe they'll update ['suv', 'convertible', 'sedan'] ['suv', 'convertible'].

what i'm not sure on store variable. create database table 1 record in gets updated, seems overkill. use memecached, send variable there, though i'm not sure if thats persistent enough. thinking of having dashboard update class variable, have dozens of servers running same app, , i'm unclear if change replicated boxes or stay on 1 box.

thanks

global variables prefixed $, example: $cars

but if application goes down? global var reinitialized default value. recommend database, caching if want save on performances.

you cache database values in $cars variable

that's personal approach: database + cache records being updated not often. cache cleared when change made in table, , cache created (with db request) during first fetch of record.

as result cause have flexibility change records sometimes, no problem arise when server goes down, or multi-threading, , cache permit not kill performances


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -