Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/labor-digital/typo3-distributed-cache-clearing
Handler to clear the cache in multi-container setups
https://github.com/labor-digital/typo3-distributed-cache-clearing
Last synced: about 1 month ago
JSON representation
Handler to clear the cache in multi-container setups
- Host: GitHub
- URL: https://github.com/labor-digital/typo3-distributed-cache-clearing
- Owner: labor-digital
- License: apache-2.0
- Created: 2022-05-24T15:24:45.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-25T09:53:10.000Z (over 2 years ago)
- Last Synced: 2024-11-21T04:49:49.132Z (about 1 month ago)
- Language: PHP
- Size: 42 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# TYPO3 Distributed Cache Clearing
Utility extension to clear the local file caches in a multi-container setup. It is designed to be easily extendable
with all kinds of message queue backends. By default a DB/TYPO3 Registry and Redis backend are included.## Requirements
- TYPO3 v10
- [TYPO3 - Better API](https://github.com/labor-digital/typo3-better-api)
- Installation using Composer## Installation
Install this package using Composer:
```
composer require labor-digital/typo3-distributed-cache-clearing
```## Usage
To utilize the distributed cache clearing you need to register a backend class using the ext config logic.
This will activate the message handling when the TYPO3 cache is cleared in the backend or though the CLI.```php
setMessageBackend(RegistryMessageBackend::class);
}
}
```In order to listen for the cache cleared event emitted in another container you can use multiple approaches.
The first one, which is the simplest to implement is by setting the "check in every request" option to true.
It is also done in the ext config class. The major downside of this option is a potential dip in your performance,
especially if external event queues (SNS, ServiceBus, ...) are used.```php
setCheckInEveryRequest(true)
}
}
```If your infrastructure allows you to perform an HTTP request to EACH container independently,
and you use the T3FA extension, you may use the `DccBundle` in your site routing configuration
The route will be available at: `/api/dcc/clearIfRequired`.```php
register(DccBundle::class);
}
/* ... */
}
```Alternatively you can use the built-in cli command `t3dcc:handleMessages` which does the same.
As as last resort for highly specialized setups you can use the `/ext/t3dcc/handleMessages.php`
file provided by the extension. It can be executed in ANY other PHP script, even without TYPO3 context.
It contains an encapsulated bootstrap and small application to boot up the TYPO3 core and flush the caches
if needed. Before you can include the file you need to set `T3DCC_AUTOLOAD_PATH` either as environment variable,
or constant to the absolute path to your composer autoload.php. The rest should work automatically.This script would be located in the `public/typo3conf` directory of your installation.
```php
setMessageBackend(
RedisMessageBackend::class,
[
// Required
'hostname' => 'host',
// The following options are optional
'password' => '', // Only needed if the host requires a password
'database' => 1, // It is not required, but recommended to set a database id here (Default: 1),
'port' => 6379,
'ttl' => 60 * 15
]
);
}
}
```## Postcardware
You're free to use this package, but if it makes it to your production environment, we highly appreciate you sending us a postcard from your hometown,
mentioning which of our package(s) you are using.Our address is: LABOR.digital - Fischtorplatz 21 - 55116 Mainz, Germany.
We publish all received postcards on our [company website](https://labor.digital).