|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-01 10:19 UTC] citd at mediaways dot net
In "Serversite Javascript" exists the (global) "project" variable. The content of this variable is persistent as long as the Web-Server isn't restarted. This concept is IMHO great for e.g. configuration-variables. Load the configuration once and be done with it until the web-server is restarted. In a project i'm assigned to the configuration is stored in a Oracle-DB. As the configuration must only be parsed once after restarting the web-server the cost of about 2 seconds is no problem at all. In PHP we would have to do this every time a uses requests a page, which is to costly. Currently seems like we have to make an external "Configuration2PHP"-Script which fetches the current configuration and makes a static (PHP-)file out the configuration. (The "application" is "stateless", so it can't be achieved over a session. (->reading the config-reading once per user). And the application is running on many web-servers. With the stateless design the load-balancing is easier as you don't have to "bind" a session to a specific web-server or making a DB-Session or something similar. And you don't have problems with expired/stalled sessions.) "Better(tm)" would be if a concept like a persistent variable is introduced. IMO others would appreciate that too. :-) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 18:00:01 2025 UTC |
The various opcode caches tend to implement this. mmcache and ZPS have ways to do this easily. And I will be submitting a patch to pecl/apc to support this as well shortly. That is, you can do: $var = apc_fetch('var'); And: apc_store('var',$var); We definitely don't want PHP to require a standalone marshalling process as someone suggested and as someone else suggested, no, the $_SESSION code is nothing like what would be needed for this. The main argument against using something like this is that your horizontal scalability is destroyed if you use it incorrectly. Ideally you want to architect your solution such that every request is sandboxed from every other so that you can handle an entire browsing session on any of dozens of servers behind a load balancer, for example. If you store state on a single machine like this, much like many Java apps do by storing state in the JVM, then you have a scalability nightmare on your hands.