LSMCD Usage Example

LSMCD can be used the same way you would use Memcached. Instead of installing Memcached, install LSMCD according the steps mentioned on our installation page.

You should have PHP configured for your web server (this can be any web server, not just LiteSpeed Web Server). Also the php-memcached pecl extension should be installed and enabled in PHP. To use LSMCD, you can use the same syntax as Memcached in applications.

For example, to enable Memcached for a Magento store, you will need to add a <cache></cache> section within your <global></global> section in “app/etc/local.xml”. Something like the following:

       <cache>
          <backend>memcached</backend><!-- apc / memcached / xcache / empty=file -->
          <backend_options>
              <connection></connection> <!-- Custom connection for db backend -->
              <enable_two_levels>true</enable_two_levels> <!-- Enable two level cache -->
          </backend_options>
          <slow_backend>database</slow_backend> <!-- database / file (default) - used for 2 levels cache setup, necessary for all shared memory storages -->
          <slow_backend_store_data></slow_backend_store_data> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether store data in db slow cache backend -->
          <auto_refresh_fast_cache></auto_refresh_fast_cache> <!-- 1 / 0 (default) - used for 2 levels cache setup, sets whether refresh data in fast cache backend -->
          <Memcached><!-- memcached cache backend related config -->
              <servers><!-- any number of server nodes can be included -->
                  <server>
                      <host><![CDATA[127.0.0.1]]></host>
                      <port><![CDATA[11211]]></port>
                      <persistent><![CDATA[1]]></persistent>
                      <weight><![CDATA[]]></weight>
                      <timeout><![CDATA[]]></timeout>
                      <retry_interval><![CDATA[]]></retry_interval>
                      <status><![CDATA[]]></status>
                  </server>
              </servers>
              <compression><![CDATA[0]]></compression>
              <cache_dir><![CDATA[]]></cache_dir>
              <hashed_directory_level><![CDATA[]]></hashed_directory_level>
              <hashed_directory_perm><![CDATA[]]></hashed_directory_perm>
              <file_name_prefix><![CDATA[]]></file_name_prefix>
          </Memcached>
      </cache>

Do you need to change “memcached” to “LSMCD”? Absolutely not. The above setup will make Magento stores call “LSMCD” directly. The same syntax makes LSMCD work out of your existing box if you have setup Memcached for your applications.