Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Allow caching all database queries for the lifetime of a request #20

Merged
merged 1 commit into from
Jan 29, 2018

Conversation

jorissteyn
Copy link
Contributor

This commit introduces a new metadata repository as an alternative to
the regular doctrine metadata repository. It wraps the regular
doctrine metadata repository but caches the result of each distinct
query for the request lifetime. This mechanism is safe to use for
EngineBlock since it doesn't write metadata, and we're not concerned
with metadata updates during an authentication request.

In test cases, using the caching wrapper reduces the number of queries
during a single authentication request from approximately 40 to 15.

In order to use this new repository in EngineBlock, replace the
following line in engineblock.ini:

metadataRepository.database.type = Doctrine

With:

metadataRepository.database.type = CachedDoctrine

@jorissteyn jorissteyn force-pushed the feature/caching-metadata-repository branch from 80656f3 to 34b8517 Compare January 26, 2018 15:46
This commit introduces a new metadata repository as an alternative to
the regular doctrine metadata repository. It wraps the regular
doctrine metadata repository but caches the result of each distinct
query for the request lifetime. This mechanism is safe to use for
EngineBlock since it doesn't write metadata, and we're not concerned
with metadata updates during an authentication request.

In test cases, using the caching wrapper reduces the number of queries
during a single authentication request from approximately 40 to 15.

In order to use this new repository in EngineBlock, replace the
following line in engineblock.ini:

    metadataRepository.database.type = Doctrine

With:

    metadataRepository.database.type = CachedDoctrine
@jorissteyn jorissteyn force-pushed the feature/caching-metadata-repository branch from 34b8517 to 4c11c95 Compare January 26, 2018 16:13
@jorissteyn jorissteyn merged commit 516fd9c into master Jan 29, 2018
@jorissteyn jorissteyn deleted the feature/caching-metadata-repository branch January 29, 2018 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants