Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#18123 closed enhancement (maybelater)

Callback parameter for Transients

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


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)

#1 @dd32
13 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..

#2 @plpetitclerc
13 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.

#3 @ocean90
13 years ago

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