Darren Whitlen wrote:
Stut wrote:
Darren Whitlen wrote:
I have a PHP script that reads and updates either a small file or a
mysql database. This script is called from several places every .5
seconds.
I would like to move this file to a variable for extra speed as the
file is causing a few problems being accessed so many times.
Is it possible to have a writeable variable that has the scope of
EVERY script that is run through the parser?
Not really. Your options are basically 1) use the database instead of
the file, or 2) try memcached (Google for it).
-Stut
Hmmm caching really isnt an option here as the data is always changing.
Just a wild idea here.. would it cause major overhead if a script was to
start a session, update some session vars, then switch to a common
session_id that each script can access? Then use that session to store
to my info.
Would that cause any obvious problems?
Yes, it would. Depending on the session implementation you are using,
PHP locks the session data for the duration of the request. So doing as
you suggest would mean the server could only process one request at a time.
The best option is to use a database, as this is the sort of thing they
are designed to do.
Also note that I was suggesting memcached not for it's caching
abilities, but the fact that it provides controlled access to shared
data. On reflection it's probably a bad idea because if it's always
changing then performance will suck.
-Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php