I tried to find this answer everywhere, but hit the wall.
Code: (saved as recent.php)
$MEMCACHE_SERVERS = array( "1.2.3.4", //db prodmaster "5.6.7.8", //db prodslave1 "9.10.11.12" //db1 dev ); $memcache = new Memcache(); foreach($MEMCACHE_SERVERS as $server){ $memcache->addServer($server,11211); } $key = "rec_obj_".$cat_id; $memcache->delete($key); $memcache->set($key, $objects, MEMCACHE_COMPRESSED, $time=60*60*4);
Given the code above, why does it access various caches when working from cli vs. apache? When I run php / var / www / localhost / htdocs / url / recent.php from the command line, it works fine, but I cannot extract data from my site via $ memcache-> get ($ key). Secondly, when I run the same script from the http://www.url.com/recent.php web browser, it works fine, but cannot be found from the command line? The command line results of the command line can be found on the command line $ memcache-> get ($ key), the results of the web browser can be found via $ memcache-> get ($ key) from the web browser. CLI and web caches seem separate, how can I fix this?
I checked my phpinfo (), and php-apache2 and php-cli have extension = memcache.so. Also, I thought it might be a hash difference, but both say:
Directive Local Value Master Value memcache.allow_failover 1 1 memcache.chunk_size 8192 8192 memcache.default_port 11211 11211 memcache.default_timeout_ms 1000 1000 memcache.hash_function crc32 crc32 memcache.hash_strategy consistent consistent memcache.max_failover_attempts 100 100
They also tried to deduce the status and check $ memcache-> getExtendedStats (); both from the command line and from a web browser. Both show all 3 servers. Some of the values ββare different, although, for example, curr_items or fixed, but disabled by 10 or so.
I feel that I am missing something. I could do a crawl and just save the data in a MySQL table, but this will not answer the question why this is happening.
I tried to provide all the information that seems necessary to me, but feel free to ask for clarification.