php - Keep variable shared among requests -


this question has answer here:

is there way keep result of long calculation shared among requests?

for example in ruby on rails, keep in config/initializers directory run once when server booted. if 1 of initializers change, whole server has restarted. while causes undesiderable things, editing configuration , not seeing changes until realize have restart whole thing, can see use cases, example route mapping. filling whole route map array on each request might consume, @ point, noticeable part of server time.

instead fill array on server boot , keep alive until shutdown. there way of doing in php (no $_session please)?

thanks in advance.

i'll try elaborate comment more of answer, "worthy" of being accepted. since don't want use sessions (because not user-specific), need store information "somewhere". technically in typical relational database mysql or postgresql, etc. however, amount of information storing (minor config details, etc) , amount of times information accessed (probably every request), makes sense store in cache database. store of data in ram, , can set expire @ time, exist forever, or wipe on system reboot.

some examples of cache:


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -