[wp-hackers] Transients that are not re-used after their expiry are never garbage-collected

Vid Luther vid at zippykid.com
Tue May 7 05:48:30 UTC 2013


+1 on this, we see a lot of sites that migrate to us that have thousands
upon thousands of rows in the wp_options table, with the option_name
containing %transient%.. we've found this to be the case when someone
enables caching in wp-config.php but doesn't have an opcode or object cache
in place.

We're still investigating and trying to find something more common in terms
of how this happens, but it happens a lot.


On Sun, May 5, 2013 at 9:06 PM, James Collins <james at om4.com.au> wrote:

> Hi Otto,
>
> On 3 May 2013 23:34, Otto <otto at ottodestruct.com> wrote:
>
> > Why would you have a transient with a unique key? Or a key that
> > changes? This sort of defeats the point of using a transient in the
> > first place.
>
>
> The WP e-Commerce plugin includes what I think is a valid use case for
> unique transient keys: [1].
>
> The Australia Post API responses are cached using transients, and the cache
> key(s) depend on the volume/dimensions/destination of each customer's cart
> contents, which means there can be quite a few different transient cache
> keys on each store.
>
> [1]
>
> https://github.com/wp-e-commerce/WP-e-Commerce/blob/master/wpsc-shipping/australiapost.php#L284
>
>
> James
>
>
>
>
> On 3 May 2013 23:34, Otto <otto at ottodestruct.com> wrote:
>
> > Why would you have a transient with a unique key? Or a key that
> > changes? This sort of defeats the point of using a transient in the
> > first place.
> >
> > Sounds to me like you should fix the code that is using transients
> > incorrectly.
> >
> > -Otto
> >
> >
> > On Fri, May 3, 2013 at 4:18 AM, David Anderson <david at wordshell.net>
> > wrote:
> > > Hi,
> > >
> > > Just a heads-up for others who may not be aware of this - I was not
> until
> > > today, until I began to look at my options table with ~250,000 entries
> > in it
> > > (after 2 months!)...
> > >
> > > WordPress does not garbage-collect transients unless you attempt to
> > access
> > > them. This means that if you use transients with unique keys, or keys
> > that
> > > are not expected to be used after a certain time (e.g. as access
> tokens),
> > > then they may never be purged.
> > >
> > > Here's a simple plugin to provide temporary relief until this is fixed
> in
> > > core:
> > > http://downloads.wordpress.org/plugin/artiss-transient-cleaner.1.1.zip
> > >
> > > Trac ticket for the issue:
> > > http://core.trac.wordpress.org/ticket/20316#comment:16
> > >
> > > Best wishes,
> > > David
> > >
> > > --
> > > WordShell - WordPress fast from the CLI - www.wordshell.net
> > >
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list