Skip to content

Commit

Permalink
Merge pull request #806 from demiankatz/flexible-key-pattern
Browse files Browse the repository at this point in the history
Fix cache configuration for better Doctrine compatibility.
  • Loading branch information
TomHAnderson authored Jun 8, 2023
2 parents a63fb62 + f6b52c6 commit 07b4e0f
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,37 +113,36 @@ public function getValidatorConfig(): array
}

/**
* @return array<non-empty-string, array{adapter: string, options?: mixed[]}>
* @return array<non-empty-string, array{adapter: string, options?: mixed[], plugins?: mixed[]}>
*/
public function getCachesConfig(): array
{
$defaultOptions = [
'namespace' => 'DoctrineModule',
'key_pattern' => '/^[a-z0-9_\+\-\[\]\\\\$]*$/Di',
];

return [
'doctrinemodule.cache.apcu' => [
'adapter' => 'apcu',
'options' => ['namespace' => 'DoctrineModule'],
'options' => $defaultOptions,
],
'doctrinemodule.cache.array' => [
'adapter' => Memory::class,
'options' => ['namespace' => 'DoctrineModule'],
'options' => $defaultOptions,
],
'doctrinemodule.cache.filesystem' => [
'adapter' => 'filesystem',
'options' => [
'namespace' => 'DoctrineModule',
'cache_dir' => 'data/DoctrineModule/cache',
],
'options' => $defaultOptions + ['cache_dir' => 'data/DoctrineModule/cache'],
'plugins' => [['name' => 'serializer']],
],
'doctrinemodule.cache.memcached' => [
'adapter' => 'memcached',
'options' => [
'namespace' => 'DoctrineModule',
'servers' => [],
],
'options' => $defaultOptions + ['servers' => []],
],
'doctrinemodule.cache.redis' => [
'adapter' => 'redis',
'options' => [
'namespace' => 'DoctrineModule',
'options' => $defaultOptions + [
'server' => [
'host' => 'localhost',
'post' => 6379,
Expand Down

0 comments on commit 07b4e0f

Please sign in to comment.