• Resolved colah16

    (@colah16)


    I tried a few while looking at topics related to memcached on this forum.

    
    <?php
    $mem = new Memcached();
    $mem->addServer("ls.memcached", 11211);
    //$mem->connect("127.0.0.1", 11211);
    $mem->set('key1', 'This is first value', 60);
    $val = $mem->get('key1');
    echo "Get key1 value: " . $val ."<br />";
    $mem->replace('key1', 'This is replace value', 60);
    $val = $mem->get('key1');
    echo "Get key1 value: " . $val . "<br />";
    $arr = array('aaa', 'bbb', 'ccc', 'ddd');
    $mem->set('key2', $arr, 60);
    $val2 = $mem->get('key2');
    echo "Get key2 value: ";
    print_r($val2);
    echo "<br />";
    $mem->delete('key1');
    $val = $mem->get('key1');
    echo "Get key1 value: " . $val . "<br />";
    $mem->flush();
    $val2 = $mem->get('key2');
    echo "Get key2 value: ";
    print_r($val2);
    echo "<br />";
    $mem->close();
    ?>
    

    I got this response

    Get key1 value: This is first value
    Get key1 value: This is replace value
    Get key2 value: Array ( [0] => aaa [1] => bbb [2] => ccc [3] => ddd )
    Get key1 value:
    Get key2 value: 

    Based on the search results, it is determined that this result is correct.
    But even if I set the same address and same port, it comes out as faild in litespeed cache.

    Of course, the php extension is marked as enabled.
    Memcached Extension: Enabled
    Redis Extension: Enabled

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    could you please try this code to test ?

    <?php
    $m = new Memcached();
    $m->addServer('localhost', 11211);
    
    $m->set('test1', 'test2');
    $m->set('test3', 'test4');
    
    var_dump($m->get('test1'));
    echo '<br>';
    var_dump($m->get('test3'));
    ?>

    Best regards,

    Thread Starter colah16

    (@colah16)

    Even after changing and checking 5 minutes later, it was displayed as failed, so I gave up and created a topic.
    But after 3 or 4 hours, I checked and it was changed to Passed.
    I should have waited more than 5 minutes after changing the settings.

    I thought that passed was displayed when lightspeed was able to connect to memcached.
    I thought litespeed was simply checking the memcached connection and getting passed.
    So I thought it would change to passed within seconds.

    I don’t know why, but surprisingly, when I checked it this morning, it was changed to passed.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    hmmmm? I am not sure why that happens , maybe something else like opcache in place ?

    Best regards,

    Thread Starter colah16

    (@colah16)

    I am using a light speed with a WordPress Performance Improvement plug-in.
    Even the performance enhancements are turned off even jet packs.

    Plugin Support qtwrk

    (@qtwrk)

    yeah … not sure why that happens or what happened , if you can reproduce it , surely we can investigate

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘memcached – Connection Test: Failed’ is closed to new replies.