- q("DELETE FROM `cache` WHERE `updated` < '%s'",
- dbesc(datetime_convert('UTC','UTC',"now - 30 days")));
+ q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
+ dbesc(datetime_convert('UTC','UTC',"now - 30 days")), intval(CACHE_MONTH));
+
+ q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
+ dbesc(datetime_convert('UTC','UTC',"now - 7 days")), intval(CACHE_WEEK));
+
+ q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
+ dbesc(datetime_convert('UTC','UTC',"now - 1 days")), intval(CACHE_DAY));
+
+ q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
+ dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR));