M
M
MrFallen2019-05-22 15:19:09
caching
MrFallen, 2019-05-22 15:19:09

How to cache json response in Laravel?

Good afternoon, tell me how to cache the response correctly?
Let's say the API method returns up-to-date weather data that is updated every time the page is loaded. This significantly slows down the page loading speed. Can this data be cached somehow using standard Laravel tools and updated every 5 minutes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Wolf, 2019-05-22
@Wolfnsex

Can this data be cached somehow using standard Laravel tools and updated every 5 minutes?
And what prevents you from caching them, for example, in Redis with a cache lifetime of 5 minutes and checking if the data is in the cache (and if it is not there, put it there for the next 5 minutes)?
PS Lara's tools for working with the cache are well described here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question