From 387d215d16e2b086752dd47d2b4147b5a845e1e5 Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 25 Nov 2024 11:29:56 +0000 Subject: [PATCH] Fix docs linting issues Signed-off-by: George Steel --- docs/book/index.md | 2 + docs/book/v2/storage/adapter.md | 534 +++++++++--------- docs/book/v2/storage/plugin.md | 34 +- .../usage-in-a-laminas-mvc-application.md | 11 +- docs/book/v3/storage/adapter.md | 316 +++++------ docs/book/v3/storage/plugin.md | 34 +- .../usage-in-a-laminas-mvc-application.md | 9 + docs/book/v4/migration/to-version-4.md | 4 +- docs/book/v4/storage/adapter.md | 2 - docs/book/v4/storage/capabilities.md | 2 +- docs/book/v4/storage/plugin.md | 8 +- 11 files changed, 487 insertions(+), 469 deletions(-) diff --git a/docs/book/index.md b/docs/book/index.md index 7c45daeb..c8e03110 100644 --- a/docs/book/index.md +++ b/docs/book/index.md @@ -1,3 +1,4 @@ + ## Installation ### Using Composer @@ -13,3 +14,4 @@ $ composer require laminas/laminas-cache Usage in a laminas-mvc application + diff --git a/docs/book/v2/storage/adapter.md b/docs/book/v2/storage/adapter.md index c609aa0a..01f43279 100644 --- a/docs/book/v2/storage/adapter.md +++ b/docs/book/v2/storage/adapter.md @@ -95,13 +95,13 @@ The following configuration options are defined by `Laminas\Cache\Storage\Adapte are available for every supported adapter. Adapter-specific configuration options are described on adapter level below. -Option | Data Type | Default Value | Description ------- | --------- | ------------- | ----------- -`ttl` | `integer` | `0` | Time to live -`namespace` | `string` | “laminascache” | The “namespace” in which cache items will live -`key_pattern` | `null|string` | `null` | Pattern against which to validate cache keys -`readable` | `boolean` | `true` | Enable/Disable reading data from cache -`writable` | `boolean` | `true` | Enable/Disable writing data to cache +| Option | Data Type | Default Value | Description | +|---------------|-----------|----------------|------------------------------------------------| +| `ttl` | `integer` | `0` | Time to live | +| `namespace` | `string` | “laminascache” | The “namespace” in which cache items will live | +| `key_pattern` | `null | `string\|null` | Pattern against which to validate cache keys | +| `readable` | `boolean` | `true` | Enable/Disable reading data from cache | +| `writable` | `boolean` | `true` | Enable/Disable writing data to cache | ## StorageInterface @@ -568,25 +568,25 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | internal_key, atime, ctime, mtime, rtime, size, hits, ttl -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | value of `apc.use_request_time` from `php.ini` -`lockOnExpire` | 0 -`maxKeyLength` | 5182 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|---------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | internal_key, atime, ctime, mtime, rtime, size, hits, ttl | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | value of `apc.use_request_time` from `php.ini` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 5182 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|-------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | ## BlackHole Adapter @@ -607,25 +607,25 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array`, `object` -`supportedMetadata` | none -`minTtl` | 0 or 1, depending on `psr` option. -`maxTtl` | 0 -`staticTtl` | `false` or `true`, depending on `psr` option -`ttlPrecision` | 1 -`useRequestTime` | false -`lockOnExpire` | 0 -`maxKeyLength` | -1 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------------| +| `supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array`, `object` | +| `supportedMetadata` | none | +| `minTtl` | 0 or 1, depending on `psr` option. | +| `maxTtl` | 0 | +| `staticTtl` | `false` or `true`, depending on `psr` option | +| `ttlPrecision` | 1 | +| `useRequestTime` | false | +| `lockOnExpire` | 0 | +| `maxKeyLength` | -1 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`psr` | `bool` | `false` | Flag to specify whether the adapter should be compatible with `CacheItemPoolDecorator` or `SimpleCacheDecorator` +| Name | Data Type | Default Value | Description | +|-------|-----------|---------------|------------------------------------------------------------------------------------------------------------------| +| `psr` | `bool` | `false` | Flag to specify whether the adapter should be compatible with `CacheItemPoolDecorator` or `SimpleCacheDecorator` | >### Deprecation Notice > @@ -650,23 +650,23 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` -`supportedMetadata` | none -`minTtl` | 0 -`maxKeyLength` | 0 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|--------------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` | +| `supportedMetadata` | none | +| `minTtl` | 0 | +| `maxKeyLength` | 0 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. -`pathname` | `string` | "" | Pathname to the database file. -`mode` | `string` | "c" | The mode with which to open the database; please read [dba_open](http://php.net/manual/function.dba-open.php) for more information. -`handler` | `string` | "flatfile" | The name of the handler which shall be used for accessing the database. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | +| `pathname` | `string` | "" | Pathname to the database file. | +| `mode` | `string` | "c" | The mode with which to open the database; please read [dba_open](http://php.net/manual/function.dba-open.php) for more information. | +| `handler` | `string` | "flatfile" | The name of the handler which shall be used for accessing the database. | > ### This adapter doesn't support automatic expiry > @@ -692,37 +692,37 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` -`supportedMetadata` | mtime, filespec, atime, ctime -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `false` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 251 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|--------------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` | +| `supportedMetadata` | mtime, filespec, atime, ctime | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `false` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 251 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix -`cache_dir` | `string` | "" | Directory to store cache files. -`clear_stat_cache` | `boolean` | `true` | Call `clearstatcache()` enabled? -`dir_level` | `integer` | `1` | Defines how much sub-directories should be created. -`dir_permission` | `integer` | `false` | 0700 Set explicit permission on creating new directories. -`file_locking` | `boolean` | `true` | Lock files on writing. -`file_permission` | `integer` | `false` | 0600 Set explicit permission on creating new files. -`key_pattern` | `string` | `/^[a-z0-9_\+\-]*$/Di` | Validate key against pattern. -`no_atime` | `boolean` | `true` | Don’t get ‘fileatime’ as ‘atime’ on metadata. -`no_ctime` | `boolean` | `true` | Don’t get ‘filectime’ as ‘ctime’ on metadata. -`umask` | `integer|false` | `false` | Use [umask](http://wikipedia.org/wiki/Umask) to set file and directory permissions. -`suffix` | `string` | `dat` | Suffix for cache files -`tag_suffix` | `string` | `tag` | Suffix for tag files +| Name | Data Type | Default Value | Description | +|-----------------------|------------------|------------------------|-------------------------------------------------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix | +| `cache_dir` | `string` | "" | Directory to store cache files. | +| `clear_stat_cache` | `boolean` | `true` | Call `clearstatcache()` enabled? | +| `dir_level` | `integer` | `1` | Defines how much sub-directories should be created. | +| `dir_permission` | `integer` | `false` | 0700 Set explicit permission on creating new directories. | +| `file_locking` | `boolean` | `true` | Lock files on writing. | +| `file_permission` | `integer` | `false` | 0600 Set explicit permission on creating new files. | +| `key_pattern` | `string` | `/^[a-z0-9_\+\-]*$/Di` | Validate key against pattern. | +| `no_atime` | `boolean` | `true` | Don’t get ‘fileatime’ as ‘atime’ on metadata. | +| `no_ctime` | `boolean` | `true` | Don’t get ‘filectime’ as ‘ctime’ on metadata. | +| `umask` | `integer\|false` | `false` | Use [umask](http://wikipedia.org/wiki/Umask) to set file and directory permissions. | +| `suffix` | `string` | `dat` | Suffix for cache files | +| `tag_suffix` | `string` | `tag` | Suffix for tag files | Note: the `suffix` and `tag_suffix` options will be escaped in order to be safe for glob operations. @@ -742,26 +742,26 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | none -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 255 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-----------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | none | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 255 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`servers` | `array` | `[]` | List of servers in the format `[] = [string host, integer port]` -`lib_options` | `array` | `[]` | Associative array of Libmemcached options where the array key is the option name (without the prefix `OPT_`) or the constant value. The array value is the option value. Please read [the memcached setOption() page](http://php.net/manual/memcached.setoption.php) for more information +| Name | Data Type | Default Value | Description | +|---------------|-----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `servers` | `array` | `[]` | List of servers in the format `[] = [string host, integer port]` | +| `lib_options` | `array` | `[]` | Associative array of Libmemcached options where the array key is the option name (without the prefix `OPT_`) or the constant value. The array value is the option value. Please read [the memcached setOption() page](http://php.net/manual/memcached.setoption.php) for more information | ## Redis Adapter @@ -777,31 +777,31 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | ttl (Redis v2+) -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------| +| `supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | ttl (Redis v2+) | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`database` | `integer` | 0 | Set database identifier. -`lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the option name. -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. -`password` | `string` | "" | Set password. -`persistent_id` | `string` | | Set persistent id (name of the connection, leave blank to not use a persistent connection). -`resource_manager` | `string` | "" | Set the Redis resource manager to use -`server` | `string\|array` | "" | See below. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------------|---------------|---------------------------------------------------------------------------------------------| +| `database` | `integer` | 0 | Set database identifier. | +| `lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the option name. | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | +| `password` | `string` | "" | Set password. | +| `persistent_id` | `string` | | Set persistent id (name of the connection, leave blank to not use a persistent connection). | +| `resource_manager` | `string` | "" | Set the Redis resource manager to use | +| `server` | `string\|array` | "" | See below. | `server` can be described as any of the following: @@ -822,33 +822,33 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | ttl (Redis v2+) -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------| +| `supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | ttl (Redis v2+) | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the options constant value (see `RedisCluster::OPT_*` [constants](https://github.com/JetBrains/phpstorm-stubs/blob/master/redis/RedisCluster.php) for details). -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. -`password` | `string` | "" | Password to authenticate with Redis server -`name` | `string` | "" | Name to determine configuration from [php.ini](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#loading-a-cluster-configuration-by-name) (**MUST NOT** be combined with `seeds`) -`seeds` | `array` | `[]` | List of strings containing `:` (**MUST NOT** be combined with `name`) -`timeout` | `float` | `1.0` | Timeout for commands, see [PhpRedis](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#timeouts) timeouts documentation for more background. -`read_timeout` | `float` | `2.0` | Read timeout for commands, see [PhpRedis](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#timeouts) timeouts documentation for more background. -`persistent` | `bool` | `false` | Flag to specify whether to create a persistent connection or not -`version` | `string` | "" | The Redis server version. **MUST** be specified in a [Semantic Versioning 2.0.0](https://semver.org/#semantic-versioning-200) format. This information is used to determine some features/capabilities without opening a connection to the server. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the options constant value (see `RedisCluster::OPT_*` [constants](https://github.com/JetBrains/phpstorm-stubs/blob/master/redis/RedisCluster.php) for details). | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | +| `password` | `string` | "" | Password to authenticate with Redis server | +| `name` | `string` | "" | Name to determine configuration from [php.ini](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#loading-a-cluster-configuration-by-name) (**MUST NOT** be combined with `seeds`) | +| `seeds` | `array` | `[]` | List of strings containing `:` (**MUST NOT** be combined with `name`) | +| `timeout` | `float` | `1.0` | Timeout for commands, see [PhpRedis](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#timeouts) timeouts documentation for more background. | +| `read_timeout` | `float` | `2.0` | Read timeout for commands, see [PhpRedis](https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#timeouts) timeouts documentation for more background. | +| `persistent` | `bool` | `false` | Flag to specify whether to create a persistent connection or not | +| `version` | `string` | "" | The Redis server version. **MUST** be specified in a [Semantic Versioning 2.0.0](https://semver.org/#semantic-versioning-200) format. This information is used to determine some features/capabilities without opening a connection to the server. | ## Memory Adapter @@ -868,24 +868,24 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array`, `object`, `resource` -`supportedMetadata` | mtime -`minTtl` | 1 -`maxTtl` | Value of `PHP_INT_MAX` -`staticTtl` | `false` -`ttlPrecision` | 0.05 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 0 -`namespaceIsPrefix` | `false` +| Capability | Value | +|----------------------|---------------------------------------------------------------------------------| +| `supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array`, `object`, `resource` | +| `supportedMetadata` | mtime | +| `minTtl` | 1 | +| `maxTtl` | Value of `PHP_INT_MAX` | +| `staticTtl` | `false` | +| `ttlPrecision` | 0.05 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 0 | +| `namespaceIsPrefix` | `false` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`memory_limit` | `string|integer` | 50% of `memory_limit` INI value | Limit of how much memory can PHP allocate to allow store items. +| Name | Data Type | Default Value | Description | +|----------------|-------------------|---------------------------------|-----------------------------------------------------------------| +| `memory_limit` | `string\|integer` | 50% of `memory_limit` INI value | Limit of how much memory can PHP allocate to allow store items. | > #### Memory Limit > @@ -919,36 +919,36 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` -`supportedMetadata` | _id -`minTtl` | 0 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 255 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | *Option value of `namespace_separator`* +| Capability | Value | +|----------------------|-----------------------------------------------------------| +| `supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` | +| `supportedMetadata` | _id | +| `minTtl` | 0 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 255 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | *Option value of `namespace_separator`* | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`lib_option` | `array` | | Associative array of options where the array key is the option name. -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|----------------------------------------------------------------------| +| `lib_option` | `array` | | Associative array of options where the array key is the option name. | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | Available keys for `lib_option` include: -Key | Default | Description ---- | ------- | ----------- -`server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoClient docs](http://php.net/MongoClient)). -`database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. -`collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. -`connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of options to pass to `MongoClient` (see the [MongoClient docs](http://php.net/MongoClient)). -`driverOptions` | `[]` | Associative array of driver options to pass to `MongoClient` (see the [MongoClient docs](http://php.net/MongoClient)). +| Key | Default | Description | +|---------------------|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| `server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoClient docs](http://php.net/MongoClient)). | +| `database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. | +| `collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. | +| `connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of options to pass to `MongoClient` (see the [MongoClient docs](http://php.net/MongoClient)). | +| `driverOptions` | `[]` | Associative array of driver options to pass to `MongoClient` (see the [MongoClient docs](http://php.net/MongoClient)). | ## ExtMongoDB Adapter @@ -973,36 +973,36 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` -`supportedMetadata` | _id -`minTtl` | 0 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 255 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | *Option value of `namespace_separator`* +| Capability | Value | +|----------------------|-----------------------------------------------------------| +| `supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` | +| `supportedMetadata` | _id | +| `minTtl` | 0 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 255 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | *Option value of `namespace_separator`* | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`lib_option` | `array` | | Associative array of options where the array key is the option name. -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|----------------------------------------------------------------------| +| `lib_option` | `array` | | Associative array of options where the array key is the option name. | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | Available keys for `lib_option` include: -Key | Default | Description ---- | ------- | ----------- -`server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). -`database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. -`collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. -`connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of URI options (such as authentication credentials or query string parameters) to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). -`driverOptions` | `[]` | Associative array of driver options to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). +| Key | Default | Description | +|---------------------|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | +| `database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. | +| `collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. | +| `connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of URI options (such as authentication credentials or query string parameters) to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | +| `driverOptions` | `[]` | Associative array of driver options to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | ## WinCache Adapter @@ -1018,24 +1018,24 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | internal_key, ttl, hits, size -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `apc.use_request_time` `php.ini` value. -`lockOnExpire` | 0 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|-----------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | internal_key, ttl, hits, size | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `apc.use_request_time` `php.ini` value. | +| `lockOnExpire` | 0 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|-------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | ## XCache Adapter @@ -1054,28 +1054,28 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | internal_key, size, refcount, hits, ctime, atime, hvalue -`minTtl` | 1 -`maxTtl` | `xcache.var_maxttl` `php.ini` value -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `true` -`lockOnExpire` | 0 -`maxKeyLength` | 5182 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|---------------------------------------------------------------------------------------| +| `supportedDatatypes` | `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | internal_key, size, refcount, hits, ctime, atime, hvalue | +| `minTtl` | 1 | +| `maxTtl` | `xcache.var_maxttl` `php.ini` value | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `true` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 5182 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. -`admin_auth` | `boolean` | `false` | Enable admin authentication by configuration options `admin_user` and `admin_pass`. This makes XCache administration functions accessible without the need of HTTP-Authentication if `xcache.admin.enable_auth` is enabled. -`admin_user` | `string` | "" | The username of `xcache.admin.user`. -`admin_pass` | `string` | "" | The password of `xcache.admin.pass` in plain text. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | +| `admin_auth` | `boolean` | `false` | Enable admin authentication by configuration options `admin_user` and `admin_pass`. This makes XCache administration functions accessible without the need of HTTP-Authentication if `xcache.admin.enable_auth` is enabled. | +| `admin_user` | `string` | "" | The username of `xcache.admin.user`. | +| `admin_pass` | `string` | "" | The password of `xcache.admin.pass` in plain text. | ## ZendServerDisk Adapter @@ -1092,19 +1092,19 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | none -`minTtl` | 1 -`maxTtl` | 0 -`maxKeyLength` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | if 'zend_datacache.lock_on_expire' is enabled 120 else 0 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | `::` +| Capability | Value | +|----------------------|-----------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | none | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `maxKeyLength` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | if 'zend_datacache.lock_on_expire' is enabled 120 else 0 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | `::` | ## ZendServerShm Adapter @@ -1120,19 +1120,19 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | none -`minTtl` | 1 -`maxTtl` | 0 -`maxKeyLength` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | if 'zend_datacache.lock_on_expire' is enabled 120 else 0 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | `::` +| Capability | Value | +|----------------------|-----------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | none | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `maxKeyLength` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | if 'zend_datacache.lock_on_expire' is enabled 120 else 0 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | `::` | ## Examples diff --git a/docs/book/v2/storage/plugin.md b/docs/book/v2/storage/plugin.md index d2a4f5a7..435bf4e6 100644 --- a/docs/book/v2/storage/plugin.md +++ b/docs/book/v2/storage/plugin.md @@ -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 > @@ -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 @@ -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 @@ -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 > @@ -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: diff --git a/docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md b/docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md index 0652f774..491a2779 100644 --- a/docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md +++ b/docs/book/v3/application-integration/usage-in-a-laminas-mvc-application.md @@ -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. @@ -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`: +

 namespace Application;
 
@@ -93,6 +94,7 @@ return [
     // …
 ];
 
+ 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`. @@ -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: +

 namespace Application;
 
@@ -122,6 +125,7 @@ return [
     // …
 ];
 
+ ## Using Multiple Caches @@ -129,6 +133,7 @@ The use more than one cache backend, the factory `Laminas\Cache\Service\StorageC Extend the cache configuration in `config/autoload/cache.global.php` and add more cache adapters: +

 return [
     'caches' => [
@@ -147,9 +152,11 @@ return [
     ],
 ];
 
+ 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 ``` @@ -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: +

 namespace Application;
 
@@ -177,6 +185,7 @@ return [
     // …
 ];
 
+ ## Learn More diff --git a/docs/book/v3/storage/adapter.md b/docs/book/v3/storage/adapter.md index 20ea40f6..e9832c0f 100644 --- a/docs/book/v3/storage/adapter.md +++ b/docs/book/v3/storage/adapter.md @@ -95,13 +95,13 @@ The following configuration options are defined by `Laminas\Cache\Storage\Adapte are available for every supported adapter. Adapter-specific configuration options are described on adapter level below. -Option | Data Type | Default Value | Description ------- | --------- | ------------- | ----------- -`ttl` | `integer` | `0` | Time to live -`namespace` | `string` | “laminascache” | The “namespace” in which cache items will live -`key_pattern` | `null|string` | `null` | Pattern against which to validate cache keys -`readable` | `boolean` | `true` | Enable/Disable reading data from cache -`writable` | `boolean` | `true` | Enable/Disable writing data to cache +| Option | Data Type | Default Value | Description | +|---------------|----------------|----------------|------------------------------------------------| +| `ttl` | `integer` | `0` | Time to live | +| `namespace` | `string` | “laminascache” | The “namespace” in which cache items will live | +| `key_pattern` | `null\|string` | `null` | Pattern against which to validate cache keys | +| `readable` | `boolean` | `true` | Enable/Disable reading data from cache | +| `writable` | `boolean` | `true` | Enable/Disable writing data to cache | ## StorageInterface @@ -568,25 +568,25 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | internal_key, atime, ctime, mtime, rtime, size, hits, ttl -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | value of `apc.use_request_time` from `php.ini` -`lockOnExpire` | 0 -`maxKeyLength` | 5182 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|---------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | internal_key, atime, ctime, mtime, rtime, size, hits, ttl | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | value of `apc.use_request_time` from `php.ini` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 5182 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|-------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | ## BlackHole Adapter @@ -607,25 +607,25 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array`, `object` -`supportedMetadata` | none -`minTtl` | 0 or 1, depending on `psr` option. -`maxTtl` | 0 -`staticTtl` | `false` or `true`, depending on `psr` option -`ttlPrecision` | 1 -`useRequestTime` | false -`lockOnExpire` | 0 -`maxKeyLength` | -1 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------------| +| `supportedDatatypes` | `null`, `bool`, `int`, `float`, `string`, `array`, `object` | +| `supportedMetadata` | none | +| `minTtl` | 0 or 1, depending on `psr` option. | +| `maxTtl` | 0 | +| `staticTtl` | `false` or `true`, depending on `psr` option | +| `ttlPrecision` | 1 | +| `useRequestTime` | false | +| `lockOnExpire` | 0 | +| `maxKeyLength` | -1 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`psr` | `bool` | `false` | Flag to specify whether the adapter should be compatible with `CacheItemPoolDecorator` or `SimpleCacheDecorator` +| Name | Data Type | Default Value | Description | +|-------|-----------|---------------|------------------------------------------------------------------------------------------------------------------| +| `psr` | `bool` | `false` | Flag to specify whether the adapter should be compatible with `CacheItemPoolDecorator` or `SimpleCacheDecorator` | >### Deprecation Notice > @@ -650,37 +650,37 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` -`supportedMetadata` | mtime, filespec, atime, ctime -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `false` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 251 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | Option value of `namespace_separator` +| Capability | Value | +|----------------------|--------------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `string`, `null` => `string`, `boolean` => `string`, `integer` => `string`, `double` => `string` | +| `supportedMetadata` | mtime, filespec, atime, ctime | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `false` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 251 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | Option value of `namespace_separator` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix -`cache_dir` | `string` | "" | Directory to store cache files. -`clear_stat_cache` | `boolean` | `true` | Call `clearstatcache()` enabled? -`dir_level` | `integer` | `1` | Defines how much sub-directories should be created. -`dir_permission` | `integer` | `false` | 0700 Set explicit permission on creating new directories. -`file_locking` | `boolean` | `true` | Lock files on writing. -`file_permission` | `integer` | `false` | 0600 Set explicit permission on creating new files. -`key_pattern` | `string` | `/^[a-z0-9_\+\-]*$/Di` | Validate key against pattern. -`no_atime` | `boolean` | `true` | Don’t get ‘fileatime’ as ‘atime’ on metadata. -`no_ctime` | `boolean` | `true` | Don’t get ‘filectime’ as ‘ctime’ on metadata. -`umask` | `integer|false` | `false` | Use [umask](http://wikipedia.org/wiki/Umask) to set file and directory permissions. -`suffix` | `string` | `dat` | Suffix for cache files -`tag_suffix` | `string` | `tag` | Suffix for tag files +| Name | Data Type | Default Value | Description | +|-----------------------|------------------|------------------------|-------------------------------------------------------------------------------------| +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix | +| `cache_dir` | `string` | "" | Directory to store cache files. | +| `clear_stat_cache` | `boolean` | `true` | Call `clearstatcache()` enabled? | +| `dir_level` | `integer` | `1` | Defines how much sub-directories should be created. | +| `dir_permission` | `integer` | `false` | 0700 Set explicit permission on creating new directories. | +| `file_locking` | `boolean` | `true` | Lock files on writing. | +| `file_permission` | `integer` | `false` | 0600 Set explicit permission on creating new files. | +| `key_pattern` | `string` | `/^[a-z0-9_\+\-]*$/Di` | Validate key against pattern. | +| `no_atime` | `boolean` | `true` | Don’t get ‘fileatime’ as ‘atime’ on metadata. | +| `no_ctime` | `boolean` | `true` | Don’t get ‘filectime’ as ‘ctime’ on metadata. | +| `umask` | `integer\|false` | `false` | Use [umask](http://wikipedia.org/wiki/Umask) to set file and directory permissions. | +| `suffix` | `string` | `dat` | Suffix for cache files | +| `tag_suffix` | `string` | `tag` | Suffix for tag files | Note: the `suffix` and `tag_suffix` options will be escaped in order to be safe for glob operations. @@ -700,26 +700,26 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | none -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 255 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-----------------------------------------------------------------------------------------------| +| `supportedDatatypes` | `null`, `boolean`, `integer`, `double`, `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | none | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 255 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`servers` | `array` | `[]` | List of servers in the format `[] = [string host, integer port]` -`lib_options` | `array` | `[]` | Associative array of Libmemcached options where the array key is the option name (without the prefix `OPT_`) or the constant value. The array value is the option value. Please read [the memcached setOption() page](http://php.net/manual/memcached.setoption.php) for more information +| Name | Data Type | Default Value | Description | +|---------------|-----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `servers` | `array` | `[]` | List of servers in the format `[] = [string host, integer port]` | +| `lib_options` | `array` | `[]` | Associative array of Libmemcached options where the array key is the option name (without the prefix `OPT_`) or the constant value. The array value is the option value. Please read [the memcached setOption() page](http://php.net/manual/memcached.setoption.php) for more information | ## Redis Adapter @@ -735,31 +735,31 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | ttl (Redis v2+) -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------| +| `supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | ttl (Redis v2+) | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`database` | `integer` | 0 | Set database identifier. -`lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the option name. -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. -`password` | `string` | "" | Set password. -`persistent_id` | `string` | | Set persistent id (name of the connection, leave blank to not use a persistent connection). -`resource_manager` | `string` | "" | Set the Redis resource manager to use -`server` | `string\|array` | "" | See below. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------------|---------------|---------------------------------------------------------------------------------------------| +| `database` | `integer` | 0 | Set database identifier. | +| `lib_options` | `array` | `[]` | Associative array of Redis options where the array key is the option name. | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | +| `password` | `string` | "" | Set password. | +| `persistent_id` | `string` | | Set persistent id (name of the connection, leave blank to not use a persistent connection). | +| `resource_manager` | `string` | "" | Set the Redis resource manager to use | +| `server` | `string\|array` | "" | See below. | `server` can be described as any of the following: @@ -780,19 +780,19 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) -`supportedMetadata` | ttl (Redis v2+) -`minTtl` | 1 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) -`namespaceIsPrefix` | `true` -`namespaceSeparator` | none +| Capability | Value | +|----------------------|-------------------------------------------------------| +| `supportedDatatypes` | `string`, `array` (serialized), `object` (serialized) | +| `supportedMetadata` | ttl (Redis v2+) | +| `minTtl` | 1 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 512000000 (in Redis v3+, 255 otherwise) | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | none | ### Adapter Specific Options @@ -827,24 +827,24 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array`, `object`, `resource` -`supportedMetadata` | mtime -`minTtl` | 1 -`maxTtl` | Value of `PHP_INT_MAX` -`staticTtl` | `false` -`ttlPrecision` | 0.05 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 0 -`namespaceIsPrefix` | `false` +| Capability | Value | +|----------------------|---------------------------------------------------------------------------------| +| `supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array`, `object`, `resource` | +| `supportedMetadata` | mtime | +| `minTtl` | 1 | +| `maxTtl` | Value of `PHP_INT_MAX` | +| `staticTtl` | `false` | +| `ttlPrecision` | 0.05 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 0 | +| `namespaceIsPrefix` | `false` | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`memory_limit` | `string|integer` | 50% of `memory_limit` INI value | Limit of how much memory can PHP allocate to allow store items. +| Name | Data Type | Default Value | Description | +|----------------|-------------------|---------------------------------|-----------------------------------------------------------------| +| `memory_limit` | `string\|integer` | 50% of `memory_limit` INI value | Limit of how much memory can PHP allocate to allow store items. | > #### Memory Limit > @@ -879,36 +879,36 @@ This adapter implements the following interfaces: ### Capabilities -Capability | Value ----------- | ----- -`supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` -`supportedMetadata` | _id -`minTtl` | 0 -`maxTtl` | 0 -`staticTtl` | `true` -`ttlPrecision` | 1 -`useRequestTime` | `false` -`lockOnExpire` | 0 -`maxKeyLength` | 255 -`namespaceIsPrefix` | `true` -`namespaceSeparator` | *Option value of `namespace_separator`* +| Capability | Value | +|----------------------|-----------------------------------------------------------| +| `supportedDatatypes` | `string`, `null`, `boolean`, `integer`, `double`, `array` | +| `supportedMetadata` | _id | +| `minTtl` | 0 | +| `maxTtl` | 0 | +| `staticTtl` | `true` | +| `ttlPrecision` | 1 | +| `useRequestTime` | `false` | +| `lockOnExpire` | 0 | +| `maxKeyLength` | 255 | +| `namespaceIsPrefix` | `true` | +| `namespaceSeparator` | *Option value of `namespace_separator`* | ### Adapter Specific Options -Name | Data Type | Default Value | Description ----- | --------- | ------------- | ----------- -`lib_option` | `array` | | Associative array of options where the array key is the option name. -`namespace_separator` | `string` | ":" | A separator for the namespace and prefix. +| Name | Data Type | Default Value | Description | +|-----------------------|-----------|---------------|----------------------------------------------------------------------| +| `lib_option` | `array` | | Associative array of options where the array key is the option name. | +| `namespace_separator` | `string` | ":" | A separator for the namespace and prefix. | Available keys for `lib_option` include: -Key | Default | Description ---- | ------- | ----------- -`server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). -`database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. -`collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. -`connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of URI options (such as authentication credentials or query string parameters) to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). -`driverOptions` | `[]` | Associative array of driver options to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). +| Key | Default | Description | +|---------------------|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `server` | `mongodb://localhost:27017` | The MongoDB server connection string (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | +| `database` | `laminas` | Name of the database to use; MongoDB will create this database if it does not exist. | +| `collection` | `cache` | Name of the collection to use; MongoDB will create this collection if it does not exist. | +| `connectionOptions` | `['fsync' => false, 'journal' => true]` | Associative array of URI options (such as authentication credentials or query string parameters) to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | +| `driverOptions` | `[]` | Associative array of driver options to pass to `MongoDB\\Client` (see the [MongoDB\\Client docs](https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/)). | ## Examples diff --git a/docs/book/v3/storage/plugin.md b/docs/book/v3/storage/plugin.md index d2a4f5a7..435bf4e6 100644 --- a/docs/book/v3/storage/plugin.md +++ b/docs/book/v3/storage/plugin.md @@ -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 > @@ -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 @@ -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 @@ -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 > @@ -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: diff --git a/docs/book/v4/application-integration/usage-in-a-laminas-mvc-application.md b/docs/book/v4/application-integration/usage-in-a-laminas-mvc-application.md index 68712387..8fe9c82b 100644 --- a/docs/book/v4/application-integration/usage-in-a-laminas-mvc-application.md +++ b/docs/book/v4/application-integration/usage-in-a-laminas-mvc-application.md @@ -75,6 +75,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`: +

 namespace Application;
 
@@ -89,6 +90,7 @@ return [
     // …
 ];
 
+ 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`. @@ -99,6 +101,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: +

 namespace Application;
 
@@ -118,6 +121,7 @@ return [
     // …
 ];
 
+ ## Using Multiple Caches @@ -125,6 +129,7 @@ The use more than one cache backend, the factory `Laminas\Cache\Service\StorageC Extend the cache configuration in `config/autoload/cache.global.php` and add more cache adapters: +

 return [
     'caches' => [
@@ -143,9 +148,11 @@ return [
     ],
 ];
 
+ 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 ``` @@ -154,6 +161,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: +

 namespace Application;
 
@@ -173,6 +181,7 @@ return [
     // …
 ];
 
+ ## Learn More diff --git a/docs/book/v4/migration/to-version-4.md b/docs/book/v4/migration/to-version-4.md index ad0646f4..456959f0 100644 --- a/docs/book/v4/migration/to-version-4.md +++ b/docs/book/v4/migration/to-version-4.md @@ -35,10 +35,10 @@ This allows per-storage Metadata which can differ depending on the storage being - `AbstractAdapter` and `StorageInterface` are not aware of the methods `getMetadata` anymore. These were moved to the new `MetadataCapableInterface` - `Capabilities` do not provide `supportedMetadata` anymore. The supported metadata is tied to the used storage adapter and thus, was already requiring projects to explicitly know the exact implementation of the cache backend in case of using these metadatas anyway -- `KeyListIterator` and the corresponding `IteratorInterface` does not provide the `mode` `CURRENT_AS_METADATA` anymore +- `KeyListIterator` and the corresponding `IteratorInterface` does not provide the `mode` `CURRENT_AS_METADATA` anymore - `PluginOptions#getSerializer` does not create a serializer anymore if a `string` option was passed, instead, the `string` is returned - Increment and decrement feature was removed from `StorageInterface`, so there is no more `StorageInterface#incrementItem`, `StorageInterface#decrementItem`, `StorageInterface#decrementItems` and `StorageInterface#incrementItems` - - this also removes `incrementItem`, `incrementItems`, `decrementItem`, `derementItems` events (`pre`, `post` and `exception`) + - this also removes `incrementItem`, `incrementItems`, `decrementItem`, `derementItems` events (`pre`, `post` and `exception`) - Every method now has native return types - Every property now has native types - Every method argument now has native types diff --git a/docs/book/v4/storage/adapter.md b/docs/book/v4/storage/adapter.md index 3505b24f..5c062d4f 100644 --- a/docs/book/v4/storage/adapter.md +++ b/docs/book/v4/storage/adapter.md @@ -480,7 +480,6 @@ It will return an object with the following properties (or null): | `hits` | `int` | The amount of times the item was requested and returned from the backend | | `timeToLive` | `int` | The overall time to live (in seconds) the cache item was persisted for | - ### Adapter Specific Options | Name | Data Type | Default Value | Description | @@ -771,7 +770,6 @@ This adapter implements the following interfaces: |------------|----------|:---------------------------------------------| | `objectId` | `string` | The primary key within the mongo collection. | - ### Adapter Specific Options | Name | Data Type | Default Value | Description | diff --git a/docs/book/v4/storage/capabilities.md b/docs/book/v4/storage/capabilities.md index 0db2a237..f4398923 100644 --- a/docs/book/v4/storage/capabilities.md +++ b/docs/book/v4/storage/capabilities.md @@ -76,4 +76,4 @@ if ($supportedDataTypes['object']) { } else { $cache->set($key, serialize($object)); } -``` \ No newline at end of file +``` diff --git a/docs/book/v4/storage/plugin.md b/docs/book/v4/storage/plugin.md index cf66fa89..a06aa970 100644 --- a/docs/book/v4/storage/plugin.md +++ b/docs/book/v4/storage/plugin.md @@ -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