X
X
XenK2016-01-27 20:32:10
PHP
XenK, 2016-01-27 20:32:10

Cache page with data?

There was a need to use caching. The essence of the problem, there is a user profile in which there is a table with dynamic data (updated once or twice a day). When you enter the profile, this data is updated and the page is loaded for about 3-5 seconds. In this regard, the idea came to make the "Update" button, as a result of which the data will be requested as needed by the user, but before that they should remain unchanged. Actually a question how it is better to organize caching? And yes, the data is taken from the API, and is not stored on the server.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2016-01-27
@XenK

Can be cached on the server side:
1. to a file. (cheap, fairly fast, the good old way)
2. in memory. (more expensive, but faster. There are special daemons/plugins/systems like memcache or redis)
3. to the database
4. to the session (if there is a lot of data, this is not the best option. Especially considering that the session itself is stored in one of the first three storages)
On the client, you can cache in localstorage, for example.
The choice of the best caching will depend on how many visitors you have, and how much data.
The easiest option is to file.

V
VovanZ, 2016-01-27
@VovanZ

You probably already have some kind of database, the easiest way is to put it there so as not to produce entities.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question