Transients API and multisite

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.

Leave a Comment