X
  1. Home
  2. Developer tools
  3. How do I use the Object Cache feature via cPanel?

How do I use the Object Cache feature via cPanel?

On our web hosting accounts, Agency services, and Managed Servers you have access to object cache via both Redis and Memcached.

This guide details how you connect to the different object cache systems, and how you manage settings for both. This includes how you purge the cache, and settings for how much memory Redis and/or Memcached should have access to.

Activate the PHP extensions for object cache
Keep in mind that you need to activate the appropriate PHP extensions for Redis and/or Memcached before you try to use them. These instructions show you how to activate the extensions.

Settings

On our services, both Redis and Memcached are run via socket (not on a port). To access them from your website/platform, use the following details:

Memcached

Host: /tmp/memcached eller unix:///tmp/memcached
Port: 0

Redis

Host: /tmp/redis eller unix:///tmp/redis
Port: 0

You don’t need to enter any username and/or password for neither Memcached nor Redis.

How you set up a connection to Redis or Memcached varies depending on what platform you use.

Manage object cache via cPanel

If your web hosting account is located on one of our older shared hosting servers, you will not find the icon Object Cache through cPanel according to the instructions below. You may however still use Redis and/or Memcached according to the details above, but the icon itself will not be available.

The instructions below will use Redis as an example, but all settings work in the same manner for Memcached.

To adjust settings for Redis/Memcached, follow these steps:

  1. Begin by logging on to cPanel.
  2. Find the icon Object Cache under Advanced.
  3. Now, select if you want to adjust settings for Redis or Memcached using the tabs near the top of the page. This guide will use Redis for the examples, but the Memcached part works in the same way.
  4. Under Redis status you’ll see whether or not Redis is running on your account. If it says Enabled in green, it’s running. Otherwise it’ll state Disabled. You may also Stop or Restart Redis with the buttons. If Redis is currently stopped, you may start it with the Start button.
  5. Under Settings, you can enable or disable Redis on your account. This is done using the dropdown menu next to Configured status. If you want to turn it off completely, select disabled and click Stop under Redis status (as described above).
    Next to Max memory limit, you may choose how much RAM on your web hosting account that should be available to Redis. The default is 128m, which is succifient for most cases.

Please note that Redis will be restarted of you change the Max memory limit. Upon restart all cache stored within Redis will be purged.

  1. Under Information you can see various data regarding Redis.

Manage object cache via SSH

This part of the guide is intended for advanced users. The user is assumed to have a working knowledge about how to use SSH.

Apart from managing object cache via cPanel according to the instructions above, you may also handle it by accessing your web hosting account via SSH.

To start, stop or restart Redis or Memcached, use the following command:

uapi ObjectCache update_object_cache cache_name=redis/memcached action=start/stop/restart

Enter redis or memcached in the command depending on which object cache system you wish to manage. Use start, stop, or restart based on your intention.

Was this article helpful?

Related Articles