A
A
Alex2014-10-08 02:45:28
symfony
Alex, 2014-10-08 02:45:28

Symfony - data always available, how?

Good time of the day!
Interests the following:
As at authorization to remember parameters in like an array of objects.
Use sessions or storage on the client, something like web sql?
Now the whole thing is cached in redis.
For example - the user logged in, we recorded some information in the session.
The user has moved to another page on the site. You will need to display information about his friends.
In order not to make unnecessary requests, but to display the tale as quickly as possible. To make data about friends available anywhere.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Q
Quber, 2014-10-08
@Quber

Create a listener for authorization (Event Listener). When authorizing, enter data into the user session.

S
Sergey, 2014-10-08
Protko @Fesor

It is better to put such goodness in reddis and set the lifetime for the data (if your sessions are not in memory, of course). Let's say you can do this in an event listener using doctrine / cache, or even better - implement caching in a data provider service, and he can either put the cache or ask for the doctrine himself ... And no listeners are needed.
In general, is this really a bottleneck for you, or do you just want to optimize something?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question