Support » Plugin: Redis Object Cache » Removing specific keys from redis

  • Resolved Nathan Monk

    (@nathansmonk)


    Hi Till,

    Thank you for your plugin!

    TLDR: Is it possible to selectively flush keys matching a specific pattern or prefix at all?

    Background

    I run this plugin on a number of websites that have a synchronization with an external api.

    One of those sites is causing me a problem that is related to object caching.

    We run SearchWP v3 (https://searchwp.com/) on this site, and I have been through this problem with them, and they have very kindly requested that I ask a question here to see if I can reach a conclusion.

    SearchWP runs a search engine indexer across the WordPress site. As we run an import, we pause the indexer before we import the records, and then un-pause it after the records are imported successfully.

    With Redis connected, we see the indexer become ‘stuck’ after the indexer resumes. When the indexer is in this ‘stuck’ state, if you were to search for anything on the site, it will return zero results as there is nothing in the index. The only thing that un-sticks the indexer is to flush the cache.

    Another thing that did cross my mind was the Connection Timeout and Read Timeout – both set to the default 1s. I operate a few of these syncs simultaneously, and I assume that this creates a lot of activity for redis. My Cloudwatch graphs do show an increase in set commands during these periods. One thing I have attempted is to run wp cache flush after the sync, but with mixed results. I wondered if this was down to a connection timeout. But that’s likely another thread…

    SearchWP v3 saves a few options on the WordPress options tables all starting with “searchwp_”. Some of these are used to pause and unpause the indexer.

    So my question is: Is it possible to selectively flush keys matching a specific pattern or prefix at all?

    I run a redis cluster on AWS ElastiCache, and I am running version 2.0.17 of your open-source release.

    I do understand that this includes another plugin, which likely falls outside of your scope of support, but I am trying to join the dots between the plugins so any insight would be much appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Hi Nathan,

    Is it possible to selectively flush keys matching a specific pattern or prefix at all?

    Yes, you can either write your own LUA script and use the EVAL command to execute it, or upgrade to the Pro version (which has this built in).

    Generally speaking, flushing the cache, or worse, selectively flushing is usually the wrong approach and SearchWP should fix how they interact with transients and the WP object cache API. Sadly few developer do that.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.