Question

I'm trying to execute this query in PHP Redis (Predis):

for ($i=0; $i < 10000000; $i++) {
    $client->SADD('key:'.$i, $i);
}

This code takes a long time, but it shouldn't run out of memory, besides, I've edited my php.ini file and changed memory_limit to 5000M!

But, after that change, I'm still getting this error:

Fatal Error: Allowed memory size xxxxxxxxxxxx exhausted.

Était-ce utile?

La solution

Redis is a key value in memory store I.e it uses ram to store. You have changed the memory limit of php not of Redis. The sadd function is adding to the Redis. Try to find how Redis uses ram to store

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top