https://github.com/o2ps/morozko
Cache warmup library for Nette Framework
https://github.com/o2ps/morozko
cache nette-framework warmup
Last synced: 4 months ago
JSON representation
Cache warmup library for Nette Framework
- Host: GitHub
- URL: https://github.com/o2ps/morozko
- Owner: o2ps
- License: bsd-3-clause
- Created: 2018-01-01T19:40:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T09:18:17.000Z (almost 8 years ago)
- Last Synced: 2025-02-15T03:14:13.705Z (over 1 year ago)
- Topics: cache, nette-framework, warmup
- Language: PHP
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Oops/Morozko
:warning: **THIS PACKAGE IS NO LONGER MAINTAINED.** You can use the AdvancedCache module from [contributte/console-extra](https://github.com/contributte/console-extra) instead.
[](https://travis-ci.org/o2ps/Morozko)
[](https://packagist.org/packages/oops/morozko)
[](https://packagist.org/packages/oops/morozko)

> Are you warm yet, my little application?
Morozko is a utility for cache warmup in a Nette Framework application.
## Installation and requirements
```bash
$ composer require oops/morozko
```
Oops/Morozko requires PHP >= 7.1.
Oops/Morozko provides a Symfony/Console command, thus, **you must also install and configure a Symfony/Console integration package** such as [Kdyby/Console](https://github.com/Kdyby/Console) or [contributte/console](https://github.com/contributte/console).
## Usage
Register the extension in your config file. Don't forget to register a Symfony/Console integration as well:
```yaml
extensions:
morozko: Oops\Morozko\DI\MorozkoExtension
console: Kdyby\Console\DI\ConsoleExtension
```
Then you can directly run the `oops:morozko:warmup` command, or add it to your deploy process.
### Default cache warmers
By default, the `oops:morozko:warmup` command executes one default cache warmer: the `NetteConfiguratorCacheWarmer`, which compiles the DI container.
To be able to do so, it needs to know how your DI container is configured - you need to provide it with an implementation of `ConfiguratorFactoryInterface` whose `create()` method should return the same `Configurator` as in your application's `bootstrap.php`. Actually, it might be wise to use the implementation in `bootstrap.php` to prevent code duplication.
```php
addParameters([
'appDir' => __DIR__,
'wwwDir' => __DIR__ . '/../www',
]);
// ...
```
### Additional cache warmers
There are currently these official additions to the Morozko's DI container cache warmer:
- [`oops/morozko-latte-bridge`](https://github.com/o2ps/MorozkoLatteBridge) pre-compiles all Latte templates found within a configured directory.
- [`oops/morozko-doctrine-bridge`](https://github.com/o2ps/MorozkoDoctrineBridge) warms up Doctrine metadata cache and generates entity proxies.
### Custom cache warmers
You can also create your own cache warmers. Simply create a class implementing the `Oops\Morozko\CacheWarmer` interface and register it as a service into the DI container.
### Third-party cache warmers
If you have a cache warmer that you'd like to share with others, feel free to add it to this section via a pull request.