Welcome Guest, Not a member yet? Register   Sign In
php globaly persistant variables for IPC status calls in ajax for synchronous processing - SHM? APC?
#5

[eluser]phazei[/eluser]
That's why I wanted to use shared memory, doing database calls or writing updates to the file is very resource intensive. I had found an IPC class suite that emulates shared memory with either files or dbs. It does have a class that uses shmop but I didn't like that since it doesn't store anything but strings.

APC lets me write to memory creating global persistent variables. I just need to make sure the key is unique so multiple users don't interfere with eachother.

Code:
$key = MYhash($username, $salt);
apc_store($key.'info',$data);
$filestatus = apc_fetch($key.'info');

So simple. $data can be any variable.

But I want to write it into a class so I can go:
Code:
$this->apc->put($key) = $data;
$this->apc->get($key) = $data;

But I don't know how to do that because both $key and $data need to be fed to the function as parameters. AFAIK I can't assign a function a variable...

Anyone have an idea?


I don't think I can overload the assignment operator in php... Sad


Messages In This Thread
php globaly persistant variables for IPC status calls in ajax for synchronous processing - SHM? APC? - by El Forum - 02-08-2009, 05:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB