I am building an API for mobile frontend which has a search feature. Users search for articles. The back-end already has a keywords stored in Mysql. What would be the best strategy for caching so as to minimize the turnaround time.
Currently, I follow these steps:
- Sanitize query.
- Tokenize query.
- Search for similar keywords with
LIKE
(Cache form
minutes) - Find Articles having above keywords (not sure if I should cache this result.)
Order by Popularity
- Serve results.
Does Laravel cache results based on query skeleton or complete query with parameters?