Discussion:
varchar(64) on transient names
Haluk Karamete
2014-06-13 05:26:52 UTC
Permalink
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
Nicholas Ciske
2014-06-13 05:46:17 UTC
Permalink
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
Post by Haluk Karamete
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
http://codex.wordpress.org/Function_Reference/set_transient#Parameters
Haluk Karamete
2014-06-13 05:59:54 UTC
Permalink
excellent answer. thx.
Post by Nicholas Ciske
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.
_transient_ = 11 chars
64 - 11 = 53
_transient_timeout_ = 19 chars
64 - 19 = 45
http://stackoverflow.com/a/12416710
https://core.trac.wordpress.org/ticket/15058
_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
Post by Haluk Karamete
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*)
Post by Haluk Karamete
Transient name. Expected to not be SQL-escaped. Should be 45 characters
or
Post by Haluk Karamete
http://codex.wordpress.org/Function_Reference/set_transient#Parameters
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...