Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#11146 closed enhancement (wontfix)

Allow to specify when SQL queries should not be cached

Reported by: sirzooro Owned by: ryan
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Database Keywords: has-patch
Focuses: Cc:


Most of SELECT queries executed by WP core or plugins can be safely cached by plugins like DB Cache Reloaded. However there are some which are different every time (e.g. includes current date and time in WHERE clause), return different records every time (e.g. use RAND()), etc. Therefore I suggest to add common way to tell which queries should not be cached.

Attached patch adds new parameter $maybe_cache to all functions of wpdb class, which can be used to execute SELECT query.

2nd patch changes get_calendar() to use this new parameter - it executes two queries with current date/time in WHERE clause.

Attachments (2)

wp-db.php.diff (5.3 KB) - added by sirzooro 9 years ago.
general-template.php.diff (927 bytes) - added by sirzooro 9 years ago.

Download all attachments as: .zip

Change History (4)

9 years ago

#1 @Denis-de-Bernardy
9 years ago

suggesting close as wontfix. why not simply check for rand() in the query string?

#2 @ryan
9 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed


Note: See TracTickets for help on using tickets.