Skip to content

Commit

Permalink
Fix docs linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Nov 25, 2024
1 parent f25e67a commit 387d215
Show file tree
Hide file tree
Showing 11 changed files with 487 additions and 469 deletions.
2 changes: 2 additions & 0 deletions docs/book/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- markdownlint-disable -->
## Installation

### Using Composer
Expand All @@ -13,3 +14,4 @@ $ composer require laminas/laminas-cache
<a href="/laminas-cache/v3/application-integration/usage-in-a-laminas-mvc-application/">Usage in a laminas-mvc application</a>
</li>
</ul>
<!-- markdownlint-enable -->
534 changes: 267 additions & 267 deletions docs/book/v2/storage/adapter.md

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions docs/book/v2/storage/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ $cache->addPlugin($plugin);

### Plugin specific Options

Name | Data Type | Default Value | Description
---- | --------- | ------------- | -----------
`clearing_factor` | `integer` | `0` | The automatic clearing factor.
| Name | Data Type | Default Value | Description |
|-------------------|-----------|---------------|--------------------------------|
| `clearing_factor` | `integer` | `0` | The automatic clearing factor. |

> ### Adapter must implement ClearExpiredInterface
>
Expand All @@ -76,10 +76,10 @@ You may also configure the plugin to re-throw exceptions.

### Plugin specific Options

Name | Data Type | Default Value | Description
---- | --------- | ------------- | -----------
`exception_callback` | `callable|null` | null | Callback to invoke on exception; receives the exception as the sole argument.
`throw_exceptions` | `boolean` | `true` | Re-throw caught exceptions.
| Name | Data Type | Default Value | Description |
|----------------------|------------------|---------------|-------------------------------------------------------------------------------|
| `exception_callback` | `callable\|null` | null | Callback to invoke on exception; receives the exception as the sole argument. |
| `throw_exceptions` | `boolean` | `true` | Re-throw caught exceptions. |

## The IgnoreUserAbort Plugin

Expand All @@ -88,9 +88,9 @@ termination when, allowing cache write operations to complete first.

### Plugin specific Options

Name | Data Type | Default Value | Description
---- | --------- | ------------- | -----------
`exit_on_abort` | `boolean` | `true` | Terminate script execution on user abort.
| Name | Data Type | Default Value | Description |
|-----------------|-----------|---------------|-------------------------------------------|
| `exit_on_abort` | `boolean` | `true` | Terminate script execution on user abort. |

## The OptimizeByFactor Plugin

Expand All @@ -99,9 +99,9 @@ randomly (by factor) after removing items from the cache.

### Plugin specific Options

Name | Data Type | Default Value | Description
---- | --------- | ------------- | -----------
`optimizing_factor` | `integer` | `0` | The automatic optimization factor.
| Name | Data Type | Default Value | Description |
|---------------------|-----------|---------------|------------------------------------|
| `optimizing_factor` | `integer` | `0` | The automatic optimization factor. |

> ### Adapter must implement OptimizableInterface
>
Expand All @@ -116,10 +116,10 @@ by the underlying storage adapter.

### Plugin specific Options

Name | Data Type | Default Value | Description
---- | --------- | ------------- | -----------
`serializer` | `null|string|Laminas\Serializer\Adapter\AdapterInterface` | `null` | The serializer to use; see below.
`serializer_options` | `array` | `[]` | Array of options to use when instantiating the specified serializer.
| Name | Data Type | Default Value | Description |
|----------------------|-------------------------------------------------------------|---------------|----------------------------------------------------------------------|
| `serializer` | `null\|string\|Laminas\Serializer\Adapter\AdapterInterface` | `null` | The serializer to use; see below. |
| `serializer_options` | `array` | `[]` | Array of options to use when instantiating the specified serializer. |

The `serializer` value has two special cases:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ return [
];
```
The factory `Laminas\Cache\Service\StorageCacheAbstractServiceFactory` uses the configuration, searches for the configuration key `caches` and creates the storage adapters using the discovered configuration.
The factory `Laminas\Cache\Service\StorageCacheAbstractServiceFactory` uses the configuration, searches for the configuration key `caches` and creates the storage adapters using the discovered configuration.
WARNING: **Cache Named `config` Is Not Possible**
A cache named `config` is not possible due to internal service conflicts with MVC configuration.
Expand Down Expand Up @@ -79,6 +79,7 @@ final class IndexController extends AbstractActionController
To [register the controller](https://docs.laminas.dev/laminas-mvc/quick-start/#create-a-route) for the application, extend the configuration of the module.
Add the following lines to the module configuration file, e.g. `module/Application/config/module.config.php`:
<!-- markdownlint-disable no-inline-html -->
<pre class="language-php" data-line="3,8"><code>
namespace Application;
Expand All @@ -93,6 +94,7 @@ return [
// …
];
</code></pre>
<!-- markdownlint-enable no-inline-html -->
The example uses the [config factory from laminas-servicemanager](https://docs.laminas.dev/laminas-servicemanager/config-abstract-factory/) which allows any string to be used to fetch a service from the application service container, like the name of the configured cache: `default-cache`.
Expand All @@ -103,6 +105,7 @@ This means that the factory [searches for an appropriate configuration](https://
Extend the module configuration file to add the configuration for the controller.
Use the name of the cache (`default-cache`), which was previously defined in the configuration of the caches, to retrieve the related cache storage instance:
<!-- markdownlint-disable no-inline-html -->
<pre class="language-php" data-line="11-15"><code>
namespace Application;
Expand All @@ -122,13 +125,15 @@ return [
// …
];
</code></pre>
<!-- markdownlint-enable no-inline-html -->
## Using Multiple Caches
The use more than one cache backend, the factory `Laminas\Cache\Service\StorageCacheAbstractServiceFactory` allows to define multiple cache storages.
Extend the cache configuration in `config/autoload/cache.global.php` and add more cache adapters:
<!-- markdownlint-disable no-inline-html -->
<pre class="language-php" data-line="9-14"><code>
return [
'caches' => [
Expand All @@ -147,9 +152,11 @@ return [
],
];
</code></pre>
<!-- markdownlint-enable no-inline-html -->
MISSING: **Installation Requirements**
Make sure that the [used storage adapters are installed](#preparation):
```bash
$ composer require laminas/laminas-cache-storage-adapter-memory laminas/laminas-cache-storage-adapter-blackhole
```
Expand All @@ -158,6 +165,7 @@ $ composer require laminas/laminas-cache-storage-adapter-memory laminas/laminas-
To use a different cache adapter for the controller, change the related module configuration and use one of the previously defined names:
<!-- markdownlint-disable no-inline-html -->
<pre class="language-php" data-line="13"><code>
namespace Application;
Expand All @@ -177,6 +185,7 @@ return [
// …
];
</code></pre>
<!-- markdownlint-enable no-inline-html -->
## Learn More
Expand Down
Loading

0 comments on commit 387d215

Please sign in to comment.