Cache backend consistency runtime check and graceful downgrade mecanism

Created on 21 May 2011, almost 14 years ago
Updated 28 January 2025, 26 days ago

Hello,

Cache backend management is a low-level critical functionallity, doing the Cache Backport module, I also added some code improvements into the D6 backport.

I think Drupal 7 could benefit those improvements, since they are API compatible and could avoid some crashes on misconfigured environments.

Basically, I do all of this:

  • Adding an interface for strongly environment related backends, backends that needs external libraries to run steamlessly should implement a new checkEnv() method in order for core to test if the environment if ready.
  • I added a dummy implementation of this method on the database backend, as a code sample.
  • I added a class_exists() call at cache backend instanciation time, if the current class does not exists, the backend gracefully downgrade to default.
  • Added the necessary checkEnv() calls while instanciating the backend class, and provide a graceful downgrade to default if it fails.
  • Added a bonus Null Object implementation of cache backend; this allows site administrators or developers to disable fully cache for one or more bins by configuration.

Using this interface improvements, it can be easy to implement administration screens (at least report screen) for various cache backends state, what I did in the D6 backport, and I could easily do for D7 if people are interested.

Cache backend being plugins is now being discussed for D8, so that's why I won't do a D8 patch until the solution to this problem comes up, until, this can still provide a nice consistency bugfix for D7 next release.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

cache system

Created by

πŸ‡«πŸ‡·France pounard

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024