[wp-hackers] Transient key best practice

Otto otto at ottodestruct.com
Tue Sep 10 21:44:29 UTC 2013

Note that transients are not always stored in the options table, this
is just one possible place that they can be put. So that length
limitation isn't enforced in WordPress itself because other systems
might not have the same limitation.

Still, 45 characters is reasonably long for any realistic case. MD5
produces 32 characters, leaving you another 13 for a unique prefix.
Although I'd try to avoid even that long, generally speaking.


On Tue, Sep 10, 2013 at 2:17 PM, Micky Hulse <mickyhulse.lists at gmail.com> wrote:
> One last comment for completeness's sake:
> "The option_name field in the options table has a record length of 64
> characters. So, taking into account the prefixes added to the
> transient name, a transient name can only be a maximum of 45
> characters (or 40 characters for network transients). The problem here
> is that WordPress doesn’t check. It doesn’t fail either – it creates
> the transients but simply truncates the name. And because each of the
> transient record pairs has a different length prefix then they each
> end up with a different name – this means the transient can’t be
> retrieved."
> Via: <http://www.artiss.co.uk/2013/05/using-transients>
> _______________________________________________
> 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