Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:cache:lscwp:configuration:cache:object_cache [2018/02/01 14:47]
Lisa Clarke [Install memcached, LSCMD or redis and php-memcached or php-redis]
litespeed_wiki:cache:lscwp:configuration:cache:object_cache [2020/02/10 20:23]
qtwrk [Test files]
Line 27: Line 27:
   * [[litespeed_wiki:​cache:​lscwp:​configuration:​cache:​object_cache:​redis-unix-socket|Using Redis in a UNIX Socket]]   * [[litespeed_wiki:​cache:​lscwp:​configuration:​cache:​object_cache:​redis-unix-socket|Using Redis in a UNIX Socket]]
  
-==== Config LSCWP plugin to work with running Memcached/​LSMCD/​Redis ​====+==== Config ​Object Cache in LSCWP ====
  
-If you are using LSMCD, Memcached or redis, you can set up LSCWP support in the Cache Settings tab. Navigate to **LiteSpeed Cache > Settings > Cache** and scroll down to **Object Cache**. You will need to give LSCWP some parameters, including where your Memcached or LSMCD lives, which objects you'd like to have cached, and how long you want objects to remain in cache, among other things.+If you are using LSMCD, Memcached or Redis, you can set up LSCWP support in the Cache Settings tab. Navigate to **LiteSpeed Cache > Settings > Advanced** and scroll down to **Object Cache**. You will need to give LSCWP some parameters, including where your Memcached or LSMCD lives, which objects you'd like to have cached, and how long you want objects to remain in cache, among other things.
  
 Before enabling Object Cache, the default values with already be filled in for you, like so:  Before enabling Object Cache, the default values with already be filled in for you, like so: 
Line 35: Line 35:
 {{:​litespeed_wiki:​cache:​lscwp:​configuration:​cache:​disableobject.png?​600|}} {{:​litespeed_wiki:​cache:​lscwp:​configuration:​cache:​disableobject.png?​600|}}
  
-After enabling Object Cache, the LSCache plugin will automatically run both connection testing and Memcached extension detection.+After enabling Object Cache, the LSCache plugin will automatically run both connection testing and Memcached/​Redis ​extension detection.
  
 {{:​litespeed_wiki:​cache:​lscwp:​configuration:​cache:​enabledobject.png?​600|}} {{:​litespeed_wiki:​cache:​lscwp:​configuration:​cache:​enabledobject.png?​600|}}
  
-Detailed instructions for all of these settings can be found [[litespeed_wiki:​cache:​lscwp:​configuration:​cache#​object_cache|here]].+Detailed instructions for all of these settings can be found [[litespeed_wiki:​cache:​lscwp:​configuration:​advanced#​object_cache|here]].
  
 ===== How to Verify===== ===== How to Verify=====
Line 67: Line 67:
   - Try ''​ss -lptun | grep 11211'',​ to make sure the Memcached port is listening.   - Try ''​ss -lptun | grep 11211'',​ to make sure the Memcached port is listening.
   - Try ''​telnet localhost 11211'',​ to make sure you can connect to localhost successfully.   - Try ''​telnet localhost 11211'',​ to make sure you can connect to localhost successfully.
 +
 +
 +===== Test files =====
 +
 +You can create test PHP files to test connection
 +
 +For Memcached:
 +
 +<​code>​
 +<?php
 +
 +$conn = new Memcached ;
 +$address = '/​path/​to/​memcached.sock'​ ; // set the address here
 +$port = 0 ;                            // set the port
 +$conn->​addServer( ​ $address, $port ) ;
 +var_dump( $address ) ;
 +var_dump( $port ) ;
 +var_dump( $conn->​getStats() ) ;
 +echo '<​hr>';​
 +var_dump($conn->​getServerList());​
 +?>
 +</​code>​
 +
 +For redis:
 +
 +<​code>​
 +<?php
 +
 +$cfg_host = 'redis address'​ ;
 +$cfg_port = '​6379'​ ; // or 0 if use socket
 +$cfg_pswd = ''​ ; // Set if has
 +$cfg_db = 0 ;
 +
 +
 +$conn = new Redis() ;
 +$conn->​connect( $cfg_host, $cfg_port ) ;
 +if ( $cfg_pswd ) $conn->​auth( $cfg_pswd ) ;
 +if ( $cfg_db ) $conn->​select( $cfg_db ) ;
 +
 +var_dump( $conn->​ping() ) ; // Should give a `+PONG`
 +?>
 +</​code>​
  
  • Admin
  • Last modified: 2020/05/04 13:55
  • by Shivam Saluja