WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18123 closed enhancement (maybelater)

Callback parameter for Transients

Reported by: plpetitclerc Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: General Keywords:
Focuses: Cc:

Description

The Transients API offers a way to have data expire after a user-specified delay. It would be great to add to this functionality by allowing a callback function to be provided. That callback function can be called automatically upon expiration.

Change History (3)

comment:1 dd323 years ago

The expiration of data occurs when the transient is retrieved.

For example, If the data expires at midday, and the script retrieves it at 7pm, It's at 7pm when WordPress "knows" the data has expired. For that reason alone, this doesnt seem like a worthwhile integration to me, some scripts will want to only reset the transient in a cronjob, others will want to handle it then-and-there in the script calling the transient..

comment:2 plpetitclerc3 years ago

  • Resolution set to maybelater
  • Status changed from new to closed

I wasn't aware the data expiration occurred when returning an expired transient. I guess that makes sense though. Having a user-specified function called on expiration would be another acceptable way to go about it, I think. The changes in methodology are minimal regardless - I just felt it would've made for a more robust API.

comment:3 ocean903 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.