we're using the Atlas HTML sitemap plugin, which caches the sitemap using the transients API with a call like:

set_transient( 'dmac_html_sitemap', $output, 60*60*24*7 );

Now, we also have a multi-site setup and I was wondering where the transients are stored and if WP multisite is keeping them separate. It keeps options separate as each site(blog) has its own DB table prefix (wp_29_options for example).

I read somewhere that transients could be stored with memcached - so I'm guessing the back-end storage is pluggable.

The reason for the question is that we have custom code that duplicates sites. If the transient is in the DB somewhere, it'll get copied and so I'll want to delete the cache for the newly duplicated site (part of the copy process also generates site-specific pages).

If I just call:

delete_transient( 'dmac_html_sitemap' ); 

from our plugin's network page admin, which site's transient will that delete? all? none? only the main site?

Edit: As Rarst points out below, when an external persistent cache plugin isn't being used, the transients are just stored as options (prefixed with transient). So, in that case they will be site-specific (as there is an options table for each site/blog). Hence, the question now becomes - does the wp_cache_set() and friends keep cache items separated by site by using the blog_id or something in the cache key or not? (e.g. if stored in memcached or APC for example)

1 Answer 1


Default Transient API behavior is to use Options API for storage and so behavior identical to options.

However if there is external object cache (declared by plugin or whatever) then they get stored using object cache functions instead.

So basically it will work in scope of current site, unless there are plugins that make it work otherwise.

  • So, I discovered that when looking at the source for set_transient(). However, when it calls wp_cache_set() it doesn't seem to do anything special to the transient name. Also wp_cache_set() just passes the cache key directly to $wp_object_cache->set(...). Sooo, does the wp_object_cache prefix the key with the blog_id or something? If not, then transients will collide between sites when caching is enabled, but not when just being stored in the (per-site) options table.
    – DavidJ
    Commented Jun 29, 2011 at 18:38
  • @DavidJ in transients case object cache will only be used if object cache plugin is installed, so there is no meaning to this in context of native WP code. It will be up to plugin to determine how is data cached and if it might collide.
    – Rarst
    Commented Jun 29, 2011 at 18:44
  • So, what you're saying is that the calls to $wp_object_cache->set() go to a 3rd-party cache plugin and if that is 'multisite aware' the transients will be kept separate, but if not and it just uses the transient name directly (e.g. as the APC or memcached key) then they'll clash across sites (and Atlas sitemap will display as whatever site it happened to be last cached by)
    – DavidJ
    Commented Jun 29, 2011 at 19:00
  • @DavidJ yep, although my guess would be that decent plugins are smart enough to evade collisions.
    – Rarst
    Commented Jun 29, 2011 at 19:14
  • thankyou rarst.
    – Bilwo
    Commented Feb 28, 2021 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.