Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Permanent Cache Bin

Security covered Drupal 10–11 PHP >=8.1.0
View on drupal.org

At times we need to cache some values which are not related to Drupal config or data but are coming from external systems and which don't really need to be deleted when clearing (rebuilding) Drupal cache.

This module provides a way to use Drupal cache but still keep it separate from drush cr.

Code to use this new backend in your bin (here stock is just for example):

  cache.stock:
    class: Drupal\Core\Cache\CacheBackendInterface
    tags:
      - { name: cache.bin, default_backend: cache.backend.permanent_database }
    factory: cache_factory:get
    arguments: [stock]

Update1: Memcache support is added through pcb_memcache sub-module.

Update 2: [18th Sep, 2018] Memcache version alpha7 is supported now in release 1.1, support for future versions of memcache will be added as soon as BLT supports them. Feel free to create an issue for support of beta version or new versions of memcache. There is no change done or required in main module (which uses database to store cache).

Update 2: Redis is supported now, thanks to szantog

Update 3: Use the 2.x branch for memcache 2.x, module is completely D9 ready now.

FAQ

1. How to clear permanent cache through drush?
To clear permanent cache drush pcbf [bin] (e.g. drush pcbf stock)

2. How to clear permanent cache programmatically?
\Drupal::service('cache.stock')->deleteAllPermanent();

3. How to clear permanent cache through admin?
For each cache bin using pcb, there will be a button in Admin -> Development -> Performance page (admin/config/development/performance). Use them to clear cache for specific bins through Admin UI.

4. Will cache tags and cache expiration work?
Yes, everything works as is. Only difference is when we use drush cr or try to delete all cache entries.

5. How to know which cache bins are using permanent cache?
drush pcb-list

6. How to flush cache for all bins using permanent cache?
drush pcb-flush-all

--------------------

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Aug 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
4.0.0 Stable 10–11 Sep 25, 2024
4.0.x-dev Dev 10–11 Sep 23, 2024
3.2.0 Stable Aug 10, 2024