Projections are a temporary storage and are a way to access data faster than fetching it from a regular storage (e.g. getting data from a cache vs from the database).
Data needs to be projected first so that its projection can be accessed without the need to access the actual source of truth, which is usually a slower process.
Projections have a short lifetime, and are not updated automatically if data in source of truth changes. So they need to be frequently refreshed.
This repository contains the interfaces to implement projections logic.
It also includes an implementation of the projection over the Symfony's Tag Aware Cache Pool component, which can use several cache providers, like Memcached, Redis or simply process memory, amongst others.
composer require kununu/projections
If you wish to have projections implemented via Symfony's Tag Aware Cache Pool, you must also request the required packages for that implementation
composer require symfony/cache
Also you will need to include a serializer (e.g. JMSSerializer)
composer require jms/serializer
(Or, in this example, if you want to use this library on a Symfony App you may want to require the jms/serializer-bundle
instead of jms/serializer
)
composer require jms/serializer-bundle