Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#24686 closed enhancement (wontfix)

Introduce generic filter on transient return value

Reported by: johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Cache API Keywords: has-patch 2nd-opinion
Focuses: Cc:


The get_transient() and get_site_transient() functions have a filter on their return value, but the filter name contains the transient key: transient_{$transient}.

This means it's not possible to hook into the return value for every transient in order to do something like logging transient hits and misses.

Attachments (1)

24686.patch (611 bytes) - added by johnbillion 3 years ago.

Download all attachments as: .zip

Change History (8)

3 years ago

#1 @johnbillion
3 years ago

  • Keywords has-patch added

#2 @johnbillion
3 years ago

Note that the patch on ticket #24685 is needed in conjunction with this to be of any real use.

#3 @wonderboymusic
3 years ago

  • Milestone changed from Awaiting Review to 3.7

#4 @nacin
3 years ago

Do we do anything similar for options, meta, or cache?

#5 @johnbillion
3 years ago

Nope, we don't do it for options, meta, or cache. I think it has a use case for transients though (and possibly the object cache, although that could impact performance). My use case is for logging hits and misses when fetching transients.

#6 @nacin
3 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 3.7 to Future Release

IRC discussion: http://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2013-09-17&sort=asc#m689641

Maybe an 'expired_transient' action would be useful. But if you're using a cache backend, you'll get hit and miss statistics automatically.

#7 @johnbillion
3 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.