Memcached test connection
-
howdy l, i have proble with memcached test conmection failed on shared hosting, already active memcached on php selector and works fine with this code
<?phpif (class_exists('Memcached')) { echo 'Memcached enabled'; $server = 'localhost'; if (!empty($_REQUEST['server'])) { $server = $_REQUEST['server']; } $memcache = new Memcached; $isMemcacheAvailable = @$memcache->addServer($server, 11211); if ($isMemcacheAvailable) { $aData = $memcache->get('data'); echo '<pre>'; if ($aData) { echo '<h2>Data from Cache:</h2>'; print_r($aData); } else { $aData = array( 'me' => 'you', 'us' => 'them', ); echo '<h2>Fresh Data:</h2>'; print_r($aData); $memcache->set('data', $aData, 0, 300); } $aData = $memcache->get('data'); if ($aData) { echo '<h3>Memcached seems to be working fine!</h3>'; } else { echo '<h3>Memcached DOES NOT seem to be working!</h3>'; } echo '</pre>'; }} else { echo 'Memcached not available';}?>
PHP 8, LiteSpeed Enterprise, WordPress 6.4.2, LSCache 6.0.0.1
I’ve asked the hosting support team if memcached is active, with host localhost & port 11211
- This topic was modified 11 months, 1 week ago by .
- The topic ‘Memcached test connection’ is closed to new replies.