SimpleSHM | small abstraction layer for shared memory manipulation
kandi X-RAY | SimpleSHM Summary
kandi X-RAY | SimpleSHM Summary
Shared Memory is an efficient mean of exchanging data between applications in the same machine. One application will create a memory portion which other processes can access, as long as they have the proper permissions. You can read more about it here:
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Write data to shared memory
- Read data from shared memory
- Returns true if the shared memory exists .
- Generate a unique ID .
- Sets the permissions .
- Deletes the shared memory
- Returns the unique ID .
- Returns permissions .
SimpleSHM Key Features
SimpleSHM Examples and Code Snippets
Community Discussions
Trending Discussions on SimpleSHM
QUESTION
I want to use shared memory with PHP, like describe here (SimpleSHM). But I wonder how to choose the $systemid
correctly. I have to "hardcode" the number (864, 897
in the examples) in my PHP code so different processes can interact.
But how do I make sure the same id is not used elsewhere (other application, conflicts)? If I generate the id dynamically at runtime I have a chicken / egg problem (how to share the id among my PHP segments using the shared memory).
Ok, I could generate the memory in one place, write the id to a file and read it in other places also using the shared memory. But is this the best way to go?
Code examples:
...ANSWER
Answered 2017-Jan-11 at 19:23If the idea is to have multiple different PHP scripts/libraries/classes all share memory for different purposes, necessitating a number of different $systemid values, I'd strongly suggest creating a constant for each one to give it a name. Define these constants in a file by themselves and then include/require that file in any PHP script that intends to make use of the shared memory.
E.g.:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SimpleSHM
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page