NYCPHP Meetup

NYPHP.org

Using shared data at the server level

Ophir Prusak ophir at prusak.com
Fri Mar 14 11:04:03 EST 2003


Hi All,

I'm looking for the best way to store non-critical frequently updated data
that needs to be shared across all php processes (on a single server).
Please notice I say frequently updated. If I'm just storing something that
only changes once every N requests (where N is a large number) then I'd just
use the file system since the OS caches that anyways.

For example, lets say I wanted to have a page counter on every page.
Ideally, I'd just have a variable which is read/write by any php process on
the server. Something like this:

$my_super_global ++;
print "this is page view $my_super_global";

One way is to use the file system.
This or course is pretty simple, but since the file needs to be updated
every single request, I'm thinking it would be faster to use memory.

Has anyone done anything like this ?

Does anyone know of any existing or built in packages can I use ?

thanx
ophir





More information about the talk mailing list