shared memory extention
[email protected] (Geoffrey McRae)
| Newsgroups | php.pecl.dev |
|---|---|
| Message-ID | <1271230381.3590.31.camel@geoff> |
Hi All, I have been working on a shared memory extension for PHP that uses "Shared Memory Arena" for management and storage (http://shm-arena.sourceforge.net/). The reason for writing the extention is to provide a memcache type function set that works on systems running cgi/suphp mode that is simple to implement, and cant run the server out of memory. For security each user can have a limit of 1MB of shared memory, which is owned by the running process uid, the limit is compiled into the extension but could be made a ini value fairly easily. It handles all zval types excluding (for now) array and object types. resource types will never be allowed in the cache for obvious reasons. the function set is very simple... * bool sm_create() starts/connects to the shared segment returns TRUE on success, FALSE on failure. * void sm_destroy() destroys the shared segment and all contained data. * bool sm_set(string $name, mixed $value[, int $ttl]) sets $name to $value $ttl is optional and defaults to 0 (forever) returns TRUE on success, FALSE on failure. * mixed sm_get(string $name[, mixed $default = NULL[, bool &$exists]]) gets the value of $name $default is optional, and is returned if the value does not exist &$exists is optional and is set depending if the value exists or not. returns the stored value, or $default if it does not exist. Kind Regards Geoffrey McRae