#14208 [Ana]: shm_put_var problem and new shm functions
| From: | andrey@php.net | Date: | Sat, 31 May 2003 15:32:48 +0000 |
| Subject: | #14208 [Ana]: shm_put_var problem and new shm functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40783@lists.php.net to get a copy of this message | ||
ID: 14208
Updated by: andrey@php.net
Reported By: duncan at emarketeers dot com
Status: Analyzed
Bug Type: Feature/Change Request
Operating System: All
PHP Version: 4.0.6
-Assigned To:
+Assigned To: wez
New Comment:
Assigning to Wez since he implemented sysvmsg. Hopefully he will review
the patch ;)
Previous Comments:
------------------------------------------------------------------------
[2003-01-20 11:49:10] iliaa@php.net
Please send further patches in unified format, it makes it much easier
to read :)
------------------------------------------------------------------------
[2003-01-20 10:18:06] andrey@php.net
The mail from Duncan :
It makes updates twice as fast.
My LRU code is knocking around somewhere, but I'll have to do some
rummaging if you want it.
367c367,376
< php_remove_shm_data(ptr, shm_varpos);
---
> shm_var = (sysvshm_chunk*)((char*)ptr + shm_varpos);
> /* Check the new length against the old length */
> if(shm_var->length != len ) {
> /* If not equal, remove the old entry and
prepare to create a new one */
> php_remove_shm_data(ptr, shm_varpos);
> } else {
> /* If equal, just copy the new data across and
return */
> memcpy(&(shm_var->mem),data,len);
> return 0;
> }
------------------------------------------------------------------------
[2003-01-18 12:53:21] andrey@php.net
Where is the patch?
------------------------------------------------------------------------
[2001-11-24 08:57:02] duncan at emarketeers dot com
Apologies for posting this here, but I don't know where else to go.
shm_put_var has a problem in that when you try to write a variable
which already exists, the function will fail if there is not enough
free space for the variable and its old value. I have a patch which
will simply overwrite the old value if the lengths are the same, and
will do more intelligent space checking if they are not. I will submit
this when I get back to the office.
I also have developed a set of additional shm functions which implement
an LRU cache. These functions are handy for eg caching serialized
objects which would otherwise have to be fetched from a database. And
of course they are shared across the system.
My question is: how do I submit these new functions for inclusion in
the source?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=14208&edit=1