Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] global variables in PHP

Started by streamer Oct 7, 2009 at 4:34 PM 2 replies 1.5k views
Original Post
streamer
streamer
Hi all, I'm just curious, is there any possibility to define on server startup, or first login of one user, one class (variable) that is available always to all users. Say user A logs in, sets one variable X to 5, then B logs in and see that X is 5. Something like superglobal variables. This can be ofc done with the MySql, but I need variables that exists purely in memory. Is there any way to do something like this? thanks in advance
streamer
streamer
Quote:
Original post by Konfusius
Yep, memcache can do that! You could also try APC.


Thanx!

Memcache looks exactly what I was searching for. I thought that shared memory will be the winner, but this is much better.

thanks again.
demonkoryu
demonkoryu
APC (shared memory) is much faster than memcache, where lookups suffer from network delay. Other way round, memcache can share objects across servers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.