You are browsing a version that has not yet been released.

Caching

DoctrineModule provides some pre-configured caches using Laminas\Cache, which can be utilized by either Doctrine ORM or Doctrine ODM.

The following caches are available by default:

In-Memory

Provided by laminas/laminas-cache-storage-adapter-memory, you can pull this cache from the container under the key doctrine.cache.array. It does not really do any caching and suits merely as a proof of concept or for cases, where you do not want to have caching.

Filesystem

Provided by laminas/laminas-cache-storage-adapter-filesystem, you can pull this cache from the container under the key doctrine.cache.filesystem. To override the location for the cache storage folder, use the following configuration:

1return [ 'caches' => [ 'doctrinemodule.cache.filesystem' => [ 'options' => [ 'cache_dir' => './data/cache/', ], ], ], ];
2
3
4
5
6
7
8
9

APCu

This cache requires the additional package laminas/laminas-cache-storage-adapter-apcu, which is not installed by default.

You can pull the cache from the container using the key doctrine.cache.apcu. To pass additional arguments for configuration, use the following config:

1return [ 'caches' => [ 'doctrinemodule.cache.apcu' => [ 'options' => [ ], ], ], ];
2
3
4
5
6
7
8
9

Memcached

This cache requires the additional package laminas/laminas-cache-storage-adapter-memcached, which is not installed by default.

You can pull the cache from the container using the key doctrine.cache.memcached. To pass additional arguments for configuration, use the following config:

1return [ 'caches' => [ 'doctrinemodule.cache.memcached' => [ 'options' => [ 'servers' => [ ], ], ], ], ];
2
3
4
5
6
7
8
9
10
11

Redis

This cache requires the additional package laminas/laminas-cache-storage-adapter-redis, which is not installed by default.

You can pull the cache from the container using the key doctrine.cache.redis. The default config will access a Redis server at localhost, port 6379. To pass additional arguments for configuration, or to change the default config, use the following config:

1return [ 'caches' => [ 'doctrinemodule.cache.redis' => [ 'options' => [ 'server' => [ 'host' => 'localhost', 'post' => 6379, ], ], ], ], ];
2
3
4
5
6
7
8
9
10
11
12