With regard to the use of Memcache (entry-level issues), Memcache has been configured, how can I use it to speed up access?
Title
Read a lot of information on the Internet is mostly about memcache configuration installation and Function list
It is now configured to use echo $memcache->getversion () or to print out the version.
How to do further operation to increase the response speed
For example, I now know that a very complex SQL statement takes a long time to execute.
How do I work with this SQL statement?
If the description is not clear please say I try to describe ...
Thank you ~ Memchache
Share to:
------Solution--------------------
I guess you think you're wrong about the application scenario ...
The problem with SQL first is the optimization statement
Of course, you might consider putting the table in a temporary memory table to handle
------Solution--------------------
Reference:
title
Read a lot of information on the Internet is mostly about memcache configuration installation and Function list
It is now configured to use echo $memcache->getversion () or to print out the version.
How to do further operation to increase the response speed
For example, I now know that a very complex SQL statement takes a long time to execute.
How do I work with this SQL statement?
If the description is not clear please say I try to describe ...
Thank you ~
Memcache can share the pressure of MySQL.
For example, if you have a SELECT Read statement to execute, read from the memcache cache each time you read the database, read from MySQL, and write the content to the cache for the next read from the cache.
Memcache plainly can reduce the read pressure of the database service, but also is the cache, read fast and low pressure.
And "For example I now know that a very complex SQL statement executes for a long time", if you want to make it fast you can only optimize the SQL statement.
If this is a read operation, then you can write the cache, and later read the words very quickly.
In addition, the cache should be aware that the cache is updated when the database updates and delete. ~~~
------Solution--------------------
Memcache can not relieve the pressure of the database
If that is going to put the query results in memcache for the next use, then the next time you get is not always the old data?
If you want to check if the data in the library is updated, what do you want to do with caching?
So what kind of scene is memcache fit for?
When your program is already using a file or database cache intermediate results, using Memcache can improve cache performance
------Solution--------------------
The cache is primarily applied to pages or programs that do not update for a certain time period and are frequently connected to the database, such as the weather forecast, the daily promotion page of the mall, and so on, which are relatively large and not long to update using the cache time limit, such as 8 per day update or a few time periods, to see their own needs
------Solution--------------------
You say that memcache is not used to optimize SQL statements,
It is used to temporarily StorageAccess to the database after the data, the first time to obtain data storage, the next time you do not need to query the database, but directly from the memory, so as to reduce the database access pressure.
And Memcache is equivalent to an object-oriented access interface (a procedural procedure for memory caching)
A logic like this in code
if ($mem->get (' key ')) {//Determine if it has been stored
Stored from in-memory fetch
}else{
$mem->set (' key ', ' value ')//not yet stored in cache