August 6th, 2012, 07:11 AM
"Real Time" Referenced Shared Memory?
I've known for a long time that there are "shared memory" options on the PHP fringe and tentatively planned to employ one for my new framework eventually, but now that I've research them... I'm seriously disappointed.
So far none of the options I've found are what I thought of when thinking "shared memory".
And I'm beginning to suspect my version doesn't exist, but... thought I should ask here just in case.
As for what I expected, consider the following code:
$cachedUserList =& SharedMemory("userList");
$cachedUserList = User::getUser(1);
$cachedUserList = User::getUser(2);
$cachedUserList = User::getUser(3);
After this, "userList" would exist in shared memory with 3 new elements added. Any other PHP process would see those 3 new elements in their own local $cachedUserList array without having to do anything.
References 101 + Shared Memory
At 4am the best way i can think of to describe this is "real time" shared memory, as opposed to having to set/get data--which doesn't have any accessibility advantages in my mind over storing the data in a file or database; just quicker (which has its place, of course).
If you have memory allocated for shared use, I'd think it would be a small matter to interact with it just like any other memory segment. It would just be a matter of telling PHP what data chunks you want in it.
Is this out there anywhere, hiding under a rock? Or can the popular solutions be made to interact with like this, that I missed?
Thanks in advance