Hi guys,
I have recently read about query caching. Thay say that by caching query results the iven Search engine will become incredibly fast. I know that MySQL uses caching function but I wonder whether it is a good practice to cache your queries despite this by using Php class. Any suggestions will be appreciated.
Query caching
Moderator: General Moderators
Reply
My idea was for example if there is a search engine and a user tries to search for "Apple" and in an hour another user tries to do the same search the results to have already been saved somewhere as simple XML or pure text and when there is a match with previous search instead of sending queries to the MySQL engine simply get the result from a file. I am not sure that it will benefit and that is way I am asking here.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Given it's searching a broad suggestion would be to cache. I'd implement the search functionality first and check it's speed before implementing caching - give you a baseline against which to measure any improvement.
MySQL has an internal query cache - but it relies on the database administrator enabling it and allowing it a sufficient memory limit. I've noticed it's disabled on quite a few shared hosts so depends on what your hosting environment is (can you edit MySQL settings and restart the server?).
Again, it's better to have something working before you consider whether or not caching is required. Especially for a database.
MySQL has an internal query cache - but it relies on the database administrator enabling it and allowing it a sufficient memory limit. I've noticed it's disabled on quite a few shared hosts so depends on what your hosting environment is (can you edit MySQL settings and restart the server?).
Again, it's better to have something working before you consider whether or not caching is required. Especially for a database.