deployer/docs/contrib/cachetool.md

139 lines
3.2 KiB
Markdown
Raw Normal View History

2021-09-26 15:25:58 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit contrib/cachetool.php -->
<!-- Then run bin/docgen -->
2022-07-26 09:18:44 +02:00
# Cachetool Recipe
2021-09-26 15:25:58 +02:00
2022-09-12 12:29:44 +02:00
```php
require 'contrib/cachetool.php';
```
2021-09-26 15:25:58 +02:00
2022-09-12 12:29:44 +02:00
[Source](/contrib/cachetool.php)
2021-09-26 15:25:58 +02:00
2021-11-06 19:02:51 +01:00
2021-09-26 15:25:58 +02:00
## Configuration
- **cachetool** *(optional)*: accepts a *string* with the unix socket or ip address to php-fpm. If `cachetool` is not given, then the application will look for a `cachetool.yml` file and read the configuration from there.
```php
set('cachetool', '/var/run/php-fpm.sock');
// or
set('cachetool', '127.0.0.1:9000');
```
You can also specify different cachetool settings for each host:
```php
host('staging')
->set('cachetool', '127.0.0.1:9000');
host('production')
->set('cachetool', '/var/run/php-fpm.sock');
```
By default, if no `cachetool` parameter is provided, this recipe will fallback to the global setting.
If your deployment user does not have permission to access the php-fpm.sock, you can alternatively use
the web adapter that creates a temporary php file and makes a web request to it with a configuration like
```php
set('cachetool_args', '--web --web-path=./public --web-url=https://{{hostname}}');
```
## Usage
Since APCu and OPcache deal with compiling and caching files, they should be executed right after the symlink is created for the new release:
```php
after('deploy:symlink', 'cachetool:clear:opcache');
or
after('deploy:symlink', 'cachetool:clear:apcu');
```
## Read more
Read more information about cachetool on the website:
http://gordalina.github.io/cachetool/
## Configuration
### cachetool
2022-09-12 12:29:44 +02:00
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L48)
2021-09-26 15:25:58 +02:00
### cachetool_url
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L56)
2021-09-26 15:25:58 +02:00
URL to download cachetool from if it is not available
2021-09-26 15:25:58 +02:00
CacheTool 9.x works with PHP >=8.1
CacheTool 8.x works with PHP >=8.0
CacheTool 7.x works with PHP >=7.3
2021-09-26 15:25:58 +02:00
```php title="Default value"
'https://github.com/gordalina/cachetool/releases/download/9.0.0/cachetool.phar'
```
2021-09-26 15:25:58 +02:00
### cachetool_args
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L57)
2021-10-18 18:29:14 +02:00
### bin/cachetool
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L58)
2022-09-12 12:53:42 +02:00
```php title="Default value"
if (!test('[ -f {{release_or_current_path}}/cachetool.phar ]')) {
run("cd {{release_or_current_path}} && curl -sLO {{cachetool_url}}");
}
return '{{release_or_current_path}}/cachetool.phar';
```
2021-09-26 15:25:58 +02:00
### cachetool_options
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L64)
2021-09-26 15:25:58 +02:00
2022-09-12 12:53:42 +02:00
:::info Autogenerated
The value of this configuration is autogenerated on access.
:::
2021-09-26 15:25:58 +02:00
## Tasks
### cachetool:clear:opcache
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L81)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Clears OPcode cache.
2021-09-26 15:25:58 +02:00
Clear opcache cache
### cachetool:clear:apcu
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L89)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Clears APCu system cache.
2021-09-26 15:25:58 +02:00
Clear APCU cache
### cachetool:clear:stat
[Source](https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L97)
2021-09-26 15:25:58 +02:00
2021-11-08 22:59:39 +01:00
Clears file status and realpath caches.
2021-09-26 15:25:58 +02:00
Clear file status cache, including the realpath cache