Caching - Redis Caching - Kinsta® Docs (2024)

Redis is an open-source, in-memory data structure store. In the context of WordPress, Redis can be used to store the values generated by WordPress’ native object cache in a persistent manner so that cached objects can be reused between page loads.

Using a persistent object cache such as Redis cache allows for the reuse of cached objects rather than requiring the MySQL database to be queried a second time for the same object. The result is that Redis can reduce the load on a website’s MySQL database, simultaneously decreasing the response time of the site and increasing the site’s ability to scale and handle additional traffic.

Sites that will benefit most from Redis cache

At Kinsta, page caching is built in for all sites on our platform. However, there are some sites that don’t make great use of page caching: some ecommerce sites, membership sites, forums and discussion boards, blogs with extremely active comment sections, and other types of highly dynamic websites.

These highly dynamic websites that cannot make good use of page caching are potential candidates for a persistent object caching option such as Redis.

Redis will generally not help the load time of static blogs, informational business websites, and news websites unless the sites make very poor use of our page caching.

Adding Redis to a site at Kinsta

If you would like to add Redis to your site hosted at Kinsta, follow these steps:

  1. Navigate to WordPress sites > sitename > Caching > Redis > Change.
    Caching - Redis Caching - Kinsta® Docs (1)
  2. This opens a new window that shows the pricing information for the add-on, click Open chat to start a chat with our Support team to request the Redis add-on. Please note that only users with billing permissions (Company owners, Company admins, Company billing) are able to request the addition of the add-on.
    Caching - Redis Caching - Kinsta® Docs (2)
  3. Our Support team will install Redis in your site container and the WP Redis plugin on your site. Our Billing team will add the Redis add-on subscription to your account. The add-on is $100 a month per site.

Important notes

  • If your site has both a staging and a live environment and your staging site is no longer needed, please delete it. It can then be recreated following the installation of Redis on the live site. If your staging site cannot be deleted, it will be necessary to add Redis (and the Redis plugin) to the staging site container. If this is not done, the next time staging is pushed live, the Redis installation in the LIVE environment will be overwritten and removed.
  • If you opt to discontinue using Redis, open a new chat with our Support team, ask to have Redis removed from your site container, and ask to cancel the Redis add-on subscription. You will receive a prorated credit to your Account Balance for the remaining days of the current billing period.
  • Redis cache details may not be reported correctly in the Kinsta’s APM tool if you use a plugin other than WP Redis or Redis Object Cache. This doesn’t mean that Redis isn’t working. This happens because we may not be able to collect and show Redis data from other plugins in the APM tool.

Using Redis with a WordPress website

Once Redis has been installed and integrated with your site with a plugin, it will run silently in the background.

It is critical that you test your site thoroughly after enabling object caching, being careful to review all critical processes on your website with multiple user profiles to ensure that cached objects aren’t being reused incorrectly.

If you find that cached objects are being used incorrectly, it may be possible to exclude specific groups of objects from object caching with the wp_cache_add_non_persistent_groups function. Manipulating object cache performance is outside the scope of Kinsta’s support for Redis and will require the involvement of a qualified WordPress developer.

Connect your database to RedisInsight

RedisInsight allows you to visualize your database and perform GUI- and CLI-based interactions in Redis.

  1. Download, install, and launch RedisInsight.
  2. Click Add connection details manually > select Add database manually.
  3. To connect to RedisInsight, you’ll need the following pieces of information fromthe SFTP/SSH section of each site’sInfotab withinMyKinsta:
    • host/server address (IP address)
    • username (SFTP Username, not your email address)
    • password
    • port (we take security seriously here at Kinsta, each site uses a different port)
    Caching - Redis Caching - Kinsta® Docs (3)
  4. In RedisInsight, select Use SSH Tunnel. In the section below, enter your Host, Port, Username, and Password from MyKinsta, and click Add Redis Database.

Clearing Redis cache

You can clear the cache in MyKinsta, in your WordPress dashboard, with WP-CLI, or with SSH.

Clear cache in your WordPress Dashboard

With the Kinsta MU plugin (installed by default on all Kinsta-hosted sites), you can purge object cache (and other types of cache) in your WordPress dashboard. Log in to your WordPress dashboard and do one of the following:

  • Click the Clear All Caches button on the Kinsta Cache plugin page in your WordPress dashboard.
  • Click the Clear Caches link on the WordPress admin toolbar.

Either of these methods will clear object caching and site cache (aka full-page cache).

Caching - Redis Caching - Kinsta® Docs (5)

Clear cache in MyKinsta

Log in to MyKinsta and go to WordPress Sites > sitename > Caching > Server Caching.

Click the Clear cache button to clear the site cache.

  • Clearing the site cache in MyKinsta also clears the Redis object cache.
  • When Edge Caching is enabled, clearing the site cache in MyKinsta also clears the Edge Cache.
Caching - Redis Caching - Kinsta® Docs (6)

Clear cache with WP-CLI

Connect to your server with SSH and navigate to your site’s document root:

cd public

If the Kinsta Must Use (MU) Plugin is installed on the site, you can clear the Redis object cache with this command:

wp kinsta cache purge --object

To clear all cache, add the --all flag:

wp kinsta cache purge --all

Exit SSH with the following command:

quit

Clear cache with SSH

Connect to your server with SSH and flush the Redis cache with the following command:

redis-cli flushall async

Exit SSH with the following command:

quit

Limits to Kinsta’s support for Redis

Kinsta’s support for Redis is limited to installing Redis and any required dependencies in the site container and ensuring that Redis is available for use by WordPress. Integrating Redis with your website and excluding specific groups of objects from the cache is the responsibility of each website owner. If you need assistance with the proper integration of Redis with your website, you will need to retain the services of a qualified WordPress developer.

Caching - Redis Caching - Kinsta® Docs (2024)

FAQs

Caching - Redis Caching - Kinsta® Docs? ›

Lightning-Fast Data Access: Redis stores data entirely in memory, which means it can provide sub-millisecond response times. This speed makes it an ideal choice for caching frequently accessed data, reducing database load, and improving overall application performance.

Is Redis good for caching? ›

Lightning-Fast Data Access: Redis stores data entirely in memory, which means it can provide sub-millisecond response times. This speed makes it an ideal choice for caching frequently accessed data, reducing database load, and improving overall application performance.

Can you cache files in Redis? ›

Redis is an in-memory datastore, best known for caching. Redis allows you to reduce the load on a primary database while speeding up database reads.

What are the techniques of Redis caching? ›

Two common approaches are cache-aside or lazy loading (a reactive approach) and write-through (a proactive approach). A cache-aside cache is updated after the data is requested. A write-through cache is updated immediately when the primary database is updated.

What is kinsta cache? ›

Last updated July 17, 2024. At Kinsta, we implement and manage server caching (aka full-page caching) for all sites server-side. This means there is no need for typical caching plugins. By default, the cache expires every 24 hours; you can change the expiration time, and you can manually clear the cache.

What should you not use Redis for? ›

Redis Anti-Patterns Every Developer Should Avoid
  • Large databases running on a single shard/Redis instance. ...
  • Connecting directly to Redis instances. ...
  • More than one secondary shard (Redis OSS) ...
  • Performing single operation. ...
  • Caching keys without TTL. ...
  • Endless Redis Replication Loop. ...
  • Hot Keys. ...
  • Using Keys command.

Is there anything better than Redis? ›

KeyDB Speeds Up The User Experience For Any Project

KeyDB is meant to handle heavy workloads with a single node benchmarking at over 1 million ops/sec. KeyDB is a multithreaded database and will outperform Redis on a per-node basis.

What are the disadvantages of Redis cache? ›

A disadvantage of using a key-value store, such as Redis, is that there's no query language. Additionally, Redis doesn't natively support secondary indexes. This limits your data access flexibility.

What happens when Redis cache is full? ›

Redis has built-in protections allowing the users to set a max limit on memory usage, using the maxmemory option in the configuration file to put a limit to the memory Redis can use. If this limit is reached, Redis will start to reply with an error to write commands (but will continue to accept read-only commands).

Is Redis a cache or database? ›

What is Redis? Redis (REmote DIctionary Server) is an open source, in-memory, NoSQL key/value store that is used primarily as an application cache or quick-response database.

Why is Redis cache so fast? ›

Unlike traditional databases, Redis holds all the information in memory as opposed to performing continuous reads and writes. This allows for constant-time data access, which is crucial for operations requiring high speed.

How do I speed up my Redis cache? ›

Redis Commands
  1. Check the slow log for EVALSHA , HGETALL , HMGET , MGET , and all types of SCAN commands. Lower the slow log threshold to capture more slow commands. ...
  2. Avoid the KEYS command, which does a scan of the entire keyspace.
  3. Take into account MGET commands when calculating the true ops/s.

Is Redis cache free? ›

Yes. Not only are we the home of Redis, but most of Redis' core engineers also work for Redis! We contribute extensively to the open source Redis project. We adhere to the open source version's specifications and make every effort to update our service with its latest versions.

How secure is Kinsta? ›

Kinsta's ISO 27001 certification means customers can be confident we have the security posture to keep their data secure.

What server does Kinsta use? ›

Our entire infrastructure is built on Google Cloud and Cloudflare, and is different from traditional shared, VPS, or dedicated infrastructure. Every site on our platform runs in an isolated software container that contains all of the software resources required to run the site (Linux, NGINX, PHP, MySQL).

Who uses Kinsta? ›

Websites using Kinsta
#WebsiteTraffic
1contactform7.com6%
2moneyforward.com4%
3barn2.com4%
4hootsuite.com3%
6 more rows

Is Redis faster than in-memory cache? ›

Memcached prioritizes high performance and exceptional response times. It also scales vertically, allowing you to add more servers to the caching pool to accommodate increased traffic and data loads. Redis offers comparable performance for simple caching tasks and additional features for more advanced use cases.

Is Redis good for long term storage? ›

Redis Enterprise is a fully durable database that serves all data directly from memory, using either RAM or Redis on Flash. With regards to persistent data, Redis only reads this data when both the primary and secondary shards in a high-availability database are lost.

Is Redis caching expensive? ›

Redis, as an open-source tool, is free to use in its basic form. You can download and use it without any cost. This makes it an attractive solution for businesses of all sizes who want a robust in-memory data store or cache.

Is Redis cache fast? ›

Redis stores data in memory, which means that data is stored in the server's RAM. This allows for extremely fast read and write operations compared to traditional disk-based databases.

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Delena Feil

Last Updated:

Views: 5395

Rating: 4.4 / 5 (45 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.