Re: Could apc_fetch return a pointer to data in shared memory ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2 Apr 2012, at 14:12, Simon wrote:

> Thanks Maciek
> 
> On 2 April 2012 10:37, Maciek Sokolewicz <maciek.sokolewicz@xxxxxxxxx>wrote:
> 
>> On 02-04-2012 10:12, Simon wrote:
>> 
>>> Thanks Simon. you got my hopes up there for a second.
>>> 
>>> From the php docs page:
>>> 
>>> Critics further argue that it is pointless to use a Singleton in a Shared
>>>> 
>>> Nothing Architecture like PHP where objects are unique>within the Request
>>> only anyways.
>>> 
>>> I want the the singleton class to be global to the entire application (ie
>>> shared "by reference" across all requests). I'd agree with the above
>>> critics that if you have to instantiate your singleton for each request,
>>> it's rather pointless.
>>> 
>>> Well, that's simply not possible due to the "shared nothing paradigm".
>> If you want to share, you need to either share it via another medium (such
>> as a database, as has been suggested a dozen times already) or switch to a
>> different language.
> 
> 
> 
>> PHP is based on this paradigm, and you should not expect of it to violate
>> it just because you want to do things a certain way, which is not the PHP
>> way.
>> 
> 
> The existence of memcached, shm and apc_fetch tell me that PHP already
> accepts the need for sharing data between processes. All I'm arguing for is
> the ability to share the data by reference rather than by copy.


As already mentioned several times the closest you will get is shared memory (as used by APC), but you can't access that by reference because shared read/write resources need controlled access for stability.

I can't find any material that explains how the .net framework implements application variables. You mentioned earlier that you *know* that when you access them you do so by reference. Do you have a source for this knowledge or is it some sort of sixth sense?

I would not feel comfortable having my code creating multiple pointers to a read/write segment of shared memory that then uncontrollably float around umpteen processes. If MS have something akin to this in .net I would be extremely interested in reading about how it works without imploding.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux