FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Best strategy for creating an application scoped variable?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Best strategy for creating an application scoped variable? [message #172035 is a reply to message #172034] Fri, 28 January 2011 03:24 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 1/27/2011 9:40 PM, Peter H. Coffin wrote:
> On Thu, 27 Jan 2011 16:08:01 -0800 (PST), laredotornado(at)zipmail(dot)com wrote:
>> Hi,
>>
>> I'm using PHP 5.2. I would like to populate a hash from a database
>> query. The hash should be available to all users of the application
>> and would only be updated very occasionally. The database query is
>> expensive, and I would prefer only to run it once, whenever PHP was
>> restarted, or on the rare occasion when the database data changed.
>> What is the best strategy for implementing this hash?
>
> I'm confused. What "hash" do you want to "populate"? Do you just want to
> stick a pregenerated value in a table? Maybe you need an insert/update
> trigger?
>

That was my thought - create a table in the database with the required
information and update it based on a trigger. Much easier than trying
to use shared memory or the like.

I guess an alternative would be to create a PHP file from the generated
data and include it where necessary. But there's always the problem of
updating it when the web server restarts (PHP doesn't "restart" - it
starts every time a request is made for a PHP file - and only then).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using server to list CSS page list in menu
Next Topic: passing variable to a nested array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 07:35:15 GMT 2024

Total time taken to generate the page: 0.04256 seconds