dvsa / mot-doctrine-module
DVSA Doctrine Module
Installs: 4 435
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 1
Type:module
Requires
- php: ^8.2
- ext-memcached: ^3.2
- doctrine/cache: ^1.5
- laminas/laminas-dependency-plugin: ^2.6.0
- laminas/laminas-servicemanager: ^3.10.0
- symfony/cache: ^v5.4.0
Requires (Dev)
- captainhook/plugin-composer: ^5.3
- dvsa/coding-standards: ^2.0
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.10
- vimeo/psalm: ^5.24
- dev-main
- v3.0.0
- v2.0.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feature-BL-15047-refactor-doctrine-cache
- dev-feature-BL-15047-refactor-doctrine-cache-andy
- dev-test-gh-action
- dev-test-feature-BL-15047-doctrine-cache
- dev-feature/bl-15047-add-linting
- dev-feature-bl-17026-php-82-update
- dev-feature-php-81-swimlane
- dev-fix-phpcs-misconfiguration
- dev-fix-doctrine-cache-version-composer
This package is auto-updated.
Last update: 2024-11-08 12:16:03 UTC
README
This module provides additional doctrine tools and configurations for doctrine (including doctrine/cache, DoctrineModule and DoctrineORMModule).
Installing
The recommended way to install is through Composer.
composer require dvsa/mot-doctrine-module
Cache
Cache service alias
A service factory is provided for the Doctrine\Common\Cache\Cache
service:
use Doctrine\Common\Cache\Cache;
$cache = $serviceLocator->get(Cache::class);
The service acts as an alias to a specific implementation, which needs to be configured:
return [
'cache' => [
'instance' => 'doctrine.cache.memcached'
]
]
In this case the doctrine.cache.memcached
is the service name that will be used.
Memcache
A service factory is provided for the doctrine.cache.memcache
service, which doctrine expects
if memcache driver is chosen for caching.
It can be configured with the following details (these are defaults):
return [
'cache' => [
'memcache' => [
'servers' => [
[
'host' => 'localhost',
'port' => 11211,
'persistent' => true,
'weight' => 1
],
],
],
],
]
Memcached
A service factory is provided for the doctrine.cache.memcached
service, which doctrine expects
if memcached driver is chosen for caching.
It can be configured with the following details (these are defaults):
return [
'cache' => [
'memcached' => [
'servers' => [
[
'host' => 'localhost',
'port' => 11211,
],
],
'options' => [
\Memcached::OPT_HASH => \Memcached::HASH_DEFAULT,
],
'persistent_id' => 'MOT',
],
],
]
All the parameters accepted by Memcached::addServers and Memcached::setOptions are accepted. The order in servers is significant (keys are ignored).
By default the Memcached instances are destroyed at the end of the request. To create an instance that persists between
requests, use persistent_id
to specify a unique ID for the instance. All instances created with the same persistent_id
will share the same connection. To disable persistence set persistent_id
to null
(it's enabled by default).
Warning: Memcached won't complain if it cannot connect to the server. Application will simply not cache if wrong parameters were given in the configuration.
Contributing
Please refer to our Contribution Guide.