In the latter case you could use redis, but that’s a poor, inconvenient, inefficient replacement for a global variable.