sitegeist/treasuremap

Switch between multiple cache-backend via environment configuration.

Installs: 2 836

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 0

Type:neos-package

v1.0.0 2023-05-22 12:57 UTC

This package is auto-updated.

Last update: 2024-10-22 16:34:00 UTC


README

Switch between multiple cache backendConfigurations based on a backendDiscriminator configuration.

This allows switching between cache configurations based on environment variables which enables things like green/blue caches to control cache invalidation during rollouts of larger applications.

Authors & Sponsors

The development and the public-releases of this package is generously sponsored by our employer http://www.sitegeist.de.

Configuration

The 'Sitegeist\TreasureMap\Backend\SwitchableBackend' cache backend is configured by the backendDiscriminator and the backendConfigurations the discriminator value will define which of the backend backendConfigurations will be used to instantiate the actually used backend.

Caches.yaml:

Neos_Fusion_Content: 
  backend: 'Sitegeist\TreasureMap\Backend\SwitchableBackend'
  backendOptions:
    backendDiscriminator: '%env:GREEN_OR_BLUE%'
    backendConfigurations:
      green:
        backend: 'Neos\Cache\Backend\RedisBackend'
        backendOptions:
          hostname: '%env:REDIS_HOST%'
          port: '%env:REDIS_PORT%'
          database: 11
      blue:
        backend: 'Neos\Cache\Backend\RedisBackend'
        backendOptions:
          hostname: '%env:REDIS_HOST%'
          port: '%env:REDIS_PORT%'
          database: 21 

Installation

Sitegeist.TreasureMap is available via packagist run composer require sitegeist/treasuremap to install.

We use semantic-versioning so every breaking change will increase the major-version number.

Contribution

We will gladly accept contributions. Please send us pull requests.

License

See LICENSE