Miscellaneous Flashcards
Which PSR does Cache-Component follow?
PSR-6 & PSR-16
Which interfaces/classes does the PSR-6 Cache-Component include?
- CacheException
- CacheItemInterface
- CacheItemPoolInterface
- InvalidArgumentException
How will a value be set for a cache-item?
Within the method “get”
How will a value be selected for a cache-item?
Within the method “get”
What is stampede protection?
Protecting cold cache from being written by multiple clients at a time
What are the 2 ways of symfony’s stampede protection?
- lock
- refresh before expiring
Whats the difference between PSR-6 and PSR-16?
PSR-16 is the simplified and more performant way of caching, while PSR-6 allows more complex possibilities for caching (e.g. getItem, getDeferred etc.)
Which Interfaces / Classes do the cache-contracts (PSR-16) include?
- CacheInterface
- ItemInterface
What are ways to react on events?
EventSubscriber
EventListener
Which interfaces / classes are part of the event-dispatcher component?
- EventDispatcherInterface (to dispatch the event)
- EventSubscriberInterface
- Event
Which PSR defines the event-dispatcher component?
PSR-14
https://www.php-fig.org/psr/psr-14/
Which method is implemented in the EventSubscriberInterface?
::getSubscribedEvents()
What are ways to make an EventListener to listen to an Event?
EventListener
Registering with ->addEventListener
How to add priority to an Event-listener / -subscriber?
with the parameter $priority
How can you make sure the DI-Container is configured in a valid way?
php bin/console lint:container
What are 2 ways to access services lazily from the DI-Container instead of using autowiring?
- service locator
- public service (not best practice)