Miscellaneous Flashcards

1
Q

Which PSR does Cache-Component follow?

A

PSR-6 & PSR-16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which interfaces/classes does the PSR-6 Cache-Component include?

A
  • CacheException
  • CacheItemInterface
  • CacheItemPoolInterface
  • InvalidArgumentException
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How will a value be set for a cache-item?

A

Within the method “get”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How will a value be selected for a cache-item?

A

Within the method “get”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is stampede protection?

A

Protecting cold cache from being written by multiple clients at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 2 ways of symfony’s stampede protection?

A
  1. lock
  2. refresh before expiring
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Whats the difference between PSR-6 and PSR-16?

A

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.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which Interfaces / Classes do the cache-contracts (PSR-16) include?

A
  • CacheInterface
  • ItemInterface
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are ways to react on events?

A

EventSubscriber
EventListener

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which interfaces / classes are part of the event-dispatcher component?

A
  • EventDispatcherInterface (to dispatch the event)
  • EventSubscriberInterface
  • Event
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which PSR defines the event-dispatcher component?

A

PSR-14
https://www.php-fig.org/psr/psr-14/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which method is implemented in the EventSubscriberInterface?

A

::getSubscribedEvents()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are ways to make an EventListener to listen to an Event?

A

EventListener
Registering with ->addEventListener

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to add priority to an Event-listener / -subscriber?

A

with the parameter $priority

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you make sure the DI-Container is configured in a valid way?

A
php bin/console lint:container
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are 2 ways to access services lazily from the DI-Container instead of using autowiring?

A
  • service locator
  • public service (not best practice)