[wp-hackers] Transient key best practice

Micky Hulse mickyhulse.lists at gmail.com
Mon Sep 9 20:12:40 UTC 2013


Awesome!!! :)

Thanks so much for the details and super quick replies Filippo and
Nikola, I really appreciate it!

I now have plans to MD5 and prefix a "namespace_" to the transient key.

I'm soooo glad I asked for help! I owe you guys an Oregon micro brew. :)

Have an awesome day!

Cheers,
M

P.S., (mostly a note to my future self):

In my previous e-mail I gave this example:

$transient_key =
wp_hash("namespace_youtube:playlist_or_user|||cache_time|||number_of_items",
'md5');

Looks like that second argument doesn't work like how I thought it did ...

http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/pluggable.php#L1392

Apparently it's a string that's used to salt a call to:

hash_hmac('md5', $data, $salt);

For my needs, it's looking like I should just use PHP's md5($str) function.


More information about the wp-hackers mailing list