I want to use multi-thread Puma as a production server so my code should be thread-safe. I read that the usage of global variables isn't thread-safe. What is the alternative to global variables in this case? I used global variables (without value changes) as Redis keys for set/get etc.
#initializers/redis.rb
$DRIVER_LOCATIONS = "driver_locations"
and in code
REDIS.with do |conn|
conn.geoadd($DRIVER_LOCATIONS, latitude, longitude, id)
end
Or there is no need to change something?