E
E
egorkovv2018-09-03 17:47:31
MySQL
egorkovv, 2018-09-03 17:47:31

MySql select caching for 1 minute regardless of changes in tables?

Good afternoon, is it possible to set up caching of the select in mysql according to the following logic:
1) the user enters the site, the select is called in mysql.
2) the select from point 1 is cached and stays there for 1 minute, so that other users visiting the site during this minute do not load the database with the same request.
3) A minute passes, the cache is deleted, the user calls the select again, the cache is created for 1 minute, and so on in a loop.
The problem is that, as far as I know, if the results of the select are changed (insert, update will be called), then the query cache will be deleted.
Question:
1) Is it possible to force the cache to live for 1 minute, regardless of data changes. after a minute, the cache would be deleted, the new user would again call the select, and so on in a loop.
2) After deleting the query cache, will the cache be added with new results?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2018-09-03
@egorkovv

Make whatever cache you need yourself.
There is no query cache in mysql. Seriously. Disabled in 5.7 and removed in 8.0.

R
Roman Mirilaczvili, 2018-09-03
@2ord

Read online articles about in-app caching with Memcached/Redis. You can set the lifetime of the cache keys. All caching logic is implemented in the application, not in the DBMS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question