Cache queries with dates

This post is about a small tip regarding queries that include dates in the clause. If you are not careful enough, you might be taking a performance hit.

Let’s suppose you have a database table containing articles (with the same name) and there is a field named publishing_datetime. You can store articles with a future date in that table, so that an article will be auto published when that time comes. Read More…

Caching made simple

In this tutorial we will show a very simple way to implement query caching. The goal is to create something that is versatile and easy to develop and use, even for not so experienced programmers.

The main idea is to have a PHP class which will automatically do the caching for all it’s methods. In the end, each method will have an additional parameter, which will define how long till the cache (for that function results) invalidates. If the cache is valid, we fetch the already-calculated results. Else, we run the query normally, and update the cache. Read More…

 Scroll to top