• Resolved digitaliway

    (@digitaliway)


    I am new to redis and recently just enabled the plugin on my hosting to find that two sites were using the same redis database number so they were overwriting each other. I did not know this as I am new and I need to avoid this. I need to avoid collisions if the site is cloned to staging and then back to live and hard coding config will be a problem. this seems to be a problem so there muse be a solution or possibly my hosting is the limitation. ideally this isolation would be at the server level but I do not know and looking for any advice or direction.

    if I added the below config code to my wp-config files will this work to isolate or will I have issues?

    define(‘WP_REDIS_DATABASE’, 0);

    define(
    ‘WP_REDIS_PREFIX’,
    preg_replace(‘/[^a-z0-9]/i’, ‘-‘, strtolower($_SERVER[‘HTTP_HOST’])) . ‘:’
    );

    define(
    ‘WP_CACHE_KEY_SALT’,
    strtolower($_SERVER[‘HTTP_HOST’])
    );

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

    (@tillkruess)

    You can remove WP_CACHE_KEY_SALT it will be ignored. Using WP_REDIS_DATABASE is the important part. Make sure you call redis-cli FLUSHALL once to clear all databases.

    Thread Starter digitaliway

    (@digitaliway)

    Thank you for the reply.

    can I use WP_REDIS_PREFIX And WP_REDIS_DATABASE both to have some additional separation ?

    can i define WP_REDIS_DATABASE TO 1 and then also set WP_REDIS_PREFIX to a unique name so that if another site by mistake was your plugin enabled without configs then at least it will default to database 0 until I could fix it.

    when your plugin is enabled it seems to default to database 0 so if by mistake it is enabled on many sites there would be data collisions and that is my concern. Is it standard practice to have redis running in a shared host environment not in containers? Seems like a security issue to change a config and it starts to alter another database on the server?

    will flushing the cache using the plugin work for this purpose after changing wpconfig or do I need to use ssh commands?

    Plugin Author Till Krüss

    (@tillkruess)

    Yes, you can use both of course.

    When WP_REDIS_DATABASE is not defined, then the plugin will default to 0 correct.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.