A
A
Alexey2017-01-17 01:39:45
PHP
Alexey, 2017-01-17 01:39:45

Memcache in php, cache requests only?

Hello! Does it make sense to cache the received data from the database, TOGETHER with the processing of this data in php?
Or is it enough just to cache the raw data returned by the database?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2017-01-17
@khrisanfov

Cache the result of the processing function, and the DBMS will take care of caching the result of the query.

A
Andrey Nikolaev, 2017-01-17
@gromdron

You can't just say that, it all depends on the situation.
For example, if the request takes 10 seconds, rendering and processing - 2 seconds, and this data is relevant for at least a minute, then it makes sense to cache the layout right away (it will be faster).
But if the request dies after 5 seconds, then you should not cache it.
If your query is quickly executed and requested very often, then the DBMS itself will cache it, in which case caching in the application will be unnecessary, but if it is a hodgepodge of many tables (for example, collecting a report), which is requested relatively often, but is used a limited circle of people (for example, a board of directors at a meeting), then in this case it can be cached.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question