note 108334 deleted from function.shm-get-var by danbrown

From: Date: Thu, 10 May 2012 17:08:46 +0000
Subject: note 108334 deleted from function.shm-get-var by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187657@lists.php.net to get a copy of this message
Note Submitter: shane.harter gmail.com ---- In response to the post below mine -- the Boolean wrapper class. I personally think shm_get_var should return null if a variable is not set, but it's not like this is a real problem. If you're writing booleans, and if shm_get_var returns an ambiguous "false", just call shm_has_var. No need for crazy slow class hierarchies. $var = shm_get_var($resource, "CouldBeFalseVar"); if ($var === false && !shm_has_var($resource, "CouldBeFalseVar")) { $var = null; } Optimal. For all non-false variables, one SHM op is done. For fale variables, 2 are done. Remember, SHM is a system-level resource. It doesn't "speak php" per se. When you store a non-scalar type (like an object) in there, it's going to be implicitely serialized. (e.g. Awful performance) Class wrapper of native types are pretty much always a bad idea.

« previous php.notes (#187657) next »