[wp-hackers] varchar(64) on transient names

Nicholas Ciske nl at thoughtrefinery.com
Fri Jun 13 05:46:17 UTC 2014


A transient that doesn't expire has a max name length of 53 characters yet a transient that does expire has a max name length of 45 characters. So 45 is always safe.

This is because transients are just options with a prefix:

_transient_ = 11 chars

64 - 11 = 53

_transient_timeout_ = 19 chars

64 - 19 = 45

More:
http://stackoverflow.com/a/12416710

Trac:
https://core.trac.wordpress.org/ticket/15058


_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske	

On Jun 13, 2014, at 12:26 AM, Haluk Karamete <halukkaramete at gmail.com> wrote:

> Schema says that it's got room for 64 chars.
> But we are also advised to keep it at max of 45 chars
> What takes up the 64-45?
> $transient (*string*
> <http://codex.wordpress.org/How_to_Pass_Tag_Parameters#String>) (*required*)
> Transient name. Expected to not be SQL-escaped. Should be 45 characters or
> less in length <http://core.trac.wordpress.org/ticket/15058>. @
> http://codex.wordpress.org/Function_Reference/set_transient#Parameters



More information about the wp-hackers mailing list