Skip to content

feat: added async & persistent options to Cache Redis - #9792

Merged
michalsn merged 11 commits into
codeigniter4:4.7from
ddevsr:cache-redis-persistent
Nov 21, 2025
Merged

feat: added async & persistent options to Cache Redis#9792
michalsn merged 11 commits into
codeigniter4:4.7from
ddevsr:cache-redis-persistent

Conversation

@ddevsr

@ddevsrddevsr commented Nov 10, 2025

Copy link
Copy Markdown
Collaborator

Description
Added config item to Redis in Cache.

Parameter:

  • Added async and persistent config item to predis handler.
  • Added persistent config item to redis handler.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ddevsrddevsr added enhancement PRs that improve existing functionalities 4.7 labels Nov 10, 2025
Comment threadsystem/Cache/Handlers/PredisHandler.php Outdated
@neznaika0

neznaika0 commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Comment threadapp/Config/Cache.php Outdated

@michalsnmichalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPRedis can also support the persistent option, so we should add it there too via pconnect().

The async option should note that it is used only with Predis.

Preferably, all these new options should be mentioned here: https://codeigniter.com/user_guide/libraries/caching.html#redis-caching


We could introduce a separate configuration parameter for Predis in the config and switch to using new Redis() in the PHPRedis implementation. This would allow us to support all available options in both clients without worrying about missing or incompatible parameters. However, this change would introduce a minor BC break. Thoughts?

@ddevsrddevsr changed the title feat: added async & persistent options to cache predisfeat: added async & persistent options to Cache RedisNov 10, 2025
@ddevsr

ddevsr commented Nov 10, 2025

Copy link
Copy Markdown
CollaboratorAuthor

Added for redis handler too. I want make support Sentinel, but for next PR. Maybe separate config in that PR

@neznaika0neznaika0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use Redis, but it looks good.

@ddevsr

Copy link
Copy Markdown
CollaboratorAuthor

PR #9793 for Session

@michalsnmichalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some documentation updates.

Comment threaduser_guide_src/source/changelogs/v4.7.0.rst Outdated
Comment threadapp/Config/Cache.php Outdated
Comment threaduser_guide_src/source/libraries/caching/014.php Outdated

@michalsnmichalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

PHPStan errors are not related.

Comment threadapp/Config/Cache.php
@michalsn

Copy link
Copy Markdown
Member

@ddevsr The 4.7 branch has been updated - PHPStan errors should go away. Please rebase when you have time.

@ddevsr
ddevsrforce-pushed the cache-redis-persistent branch from 7e3f107 to 7385984CompareNovember 19, 2025 17:15
@michalsn
michalsn merged commit 2609108 into codeigniter4:4.7Nov 21, 2025
50 checks passed
@michalsn

Copy link
Copy Markdown
Member

Thank you @ddevsr!

@ddevsr
ddevsr deleted the cache-redis-persistent branch November 21, 2025 09:47
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementPRs that improve existing functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ddevsr@neznaika0@michalsn@datamweb@paulbalandan