Using Object Cache
Also of note is that Transients are inherently sped up by caching plugins, where normal Options are not. A memcached plugin, for example, would make WordPress store transient values in fast memory instead of in the database. For this reason, transients should be used to store any data that is expected to expire, or which can expire at any time. Transients should also never be assumed to be in the database, since they may not be stored there at all.WordPress Codex
If you’re making use of an Object Cache, such as Memcached, then WordPress does some pretty weird and wonderful things with how it handles Transients (and, as mentioned above, it doesn’t do this with Options).
- First of all, do you have a persistent cache? That’s where, well, it persists and doesn’t get lost after every page load. Memcached is persistent, for example.
- If you don’t have persistent cache then WordPress stores Transient data both in that cache but, also, in the database, as usual. What this means is that if the cache is still available (for example trying to fetch the same data on the same page load) it will use the cache, otherwise it will fetch it from the database.
- If you have persistent cache then Transients are ONLY stored in the Object Cache and not in the database at all.