NYCPHP Meetup

NYPHP.org

[nycphp-talk] Application state solutions

Jim Hendricks jim at bizcomputinginc.com
Fri Aug 30 11:07:32 EDT 2002


> If the application data doesn't change often, you can store it in an
> included file.  If it changes in a more dynamic way, you can store it in a
> database which can be queried as needed.
>
> No?
>
> --Dan

Dan, I would agree that what you say can be done, but it does not
necessarily fit the bill of an application scoped variable in ASP.  With an
application scoped variable I can change it's value from one session & that
change is available in other sessions.  This is especially useful for things
like failover or site maint.  I use it myself for site maint so that when I
am ready to do site maint, I go into the app and into a section reserved for
developers(me) and set the maint flag.  I then wait on my developer screen
to watch the count of connected users ( also via an application scoped
variable ).  Once the count is at zero, I can then rollout my changes and
reactivate the application.  Basically through out the application are
checks for the maint flag.  If the maint flag is found to be set, it forces
the user to complete what they are on & logs them out of the app.

In PHP you would need to use shared memory to get this same behavior, unless
you used a table in your database to hold onto application level variables.

BTW, the other major advantage of application scoped variables is that they
use less memory since all sessions go to the same variable rather than each
session taking memory for these shared variables.

Jim





More information about the talk mailing list