[wp-hackers] Confusion About WordPress Cache
Otto
otto at ottodestruct.com
Fri Dec 17 14:57:17 UTC 2010
The object cache doesn't default to storing data between requests,
because it doesn't have anywhere to store it between those requests.
So for normal usage, it just acts like a memory cache in a single
request. However, if you do have a persistent storage medium, like a
memcached setup or something, then there are plugins which will extend
the wp_cache system to be persistent across requests. Example:
http://wordpress.org/extend/plugins/memcached/. For this reason, the
object cache should be treated as if it's (unreliable) persistent
storage even when it's not that way by default.
Like Austin said, the Transients API is also another option if you
need to store data with an expiration date attached to it. However,
this should not be used for storing data that is retrieved from the
database, since transients are (by default) stored in the database
anyway. Transients are intended to be used to store data that is
expensive to create and which will need to be re-created every so
often (such as data retrieved from another server, or data that takes
a lot of processing to calculate).
-Otto
More information about the wp-hackers
mailing list