PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar yossibeck
yossibeck
29 Jun 2024

since the same redis can be used for cache + session (or other stuff) only keys that match the -cache- should be used

Pull Request for Issue #43718

Summary of Changes

this code would delete ALL keys that aren't in a group regardless of being a cache or not
e.g. deleting keys that handle session or any other stuff

            if (strpos($key, $secret . self::CACHE_KEY . $group . '-') !== 0 && $mode !== 'group') {
                static::$_redis->del($key);

the code
static::$_redis->keys('*' . self::CACHE_KEY . '*');
instead of
static::$_redis->keys('*');
makes sure redis cache ONLY handles cache keys

Testing Instructions

  1. setup a redis server
  2. define that server as a cache_handler + session_handler
  3. use the same server for redis_server_host + session_redis_server_host
  4. start caching stuff - and login
    on the first delete of a non group cache - you'll lose all of your sessions
    the easiest way to do that is to connect to redis with
redis-cli -h <host name>
HOST-NAME:PORT>monitor

and you'll see after a while these commands:

HOST-NAME:PORT>KEYS "*"
HOST-NAME:PORT>DEL <session-id 1>
HOST-NAME:PORT>DEL <session-id 2>
HOST-NAME:PORT>DEL <session-id 3>
....

Actual result BEFORE applying this Pull Request

seeing the

HOST-NAME:PORT>KEYS "*"
HOST-NAME:PORT>DEL <session-id 1>
HOST-NAME:PORT>DEL <session-id 2>
HOST-NAME:PORT>DEL <session-id 3>
....

Expected result AFTER applying this Pull Request

not seeing

HOST-NAME:PORT>KEYS "*"
HOST-NAME:PORT>DEL <session-id 1>
HOST-NAME:PORT>DEL <session-id 2>
HOST-NAME:PORT>DEL <session-id 3>
....

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar yossibeck yossibeck - open - 29 Jun 2024
avatar yossibeck yossibeck - change - 29 Jun 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Jun 2024
Category Libraries
avatar yossibeck yossibeck - change - 29 Jun 2024
Labels Added: PR-4.4-dev

Add a Comment

Login with GitHub to post a comment