Mity Docs Mity Docs for Mity Digital
Sitemapamic Documentation

Clearing the cache

Your sitemap is cached forever. Well, until you clear it that is, or your ttl is set to an actual interval (check the config for more).

To clear the cache, you can do one of three things:

  • save (or delete) an Entry

  • save (or delete) a Taxonomy or Term

  • save (or delete) a Collection

  • run a please command

Saving an Entry, Collection, Taxonomy or Term will automatically clear the entire sitemap cache.

Clear the entire cache

You can force the cache to clear by running:

1php please sitemapamic:clear

This could be a good command to have as part of your deployment script.

Clear the cache of a specific area of your site New

Since v2.2.0, Sitemapamic now allows you to clear a specific sub-sitemap of your sitemap when you have mode set to multiple. See Configuration Options for more details.

List cache keys

Sitemapamic stores each part of your site in a different cache key.

If you want to clear a specific cache, but are not sure what the exact key is, you can list all of the cache keys:

1php please sitemapamic:list

Clearing a specific cache key

Your sitemap.xml file will include multiple sub-sitemap files, such as:

1<sitemapindex>
2 <sitemap>
3 <loc>http://my-awesome-domain/sitemap_blog.xml</loc>
4 </sitemap>
5 <sitemap>
6 <loc>http://statatest.test/sitemap_blog_tags.xml</loc>
7 </sitemap>
8 <sitemap>
9 <loc>http://my-awesome-domain/sitemap_pages.xml</loc>
10 </sitemap>
11 <!-- ... More sitemaps would be here ... -->
12</sitemapindex

To just clear the pages sub-sitemap, pass pages as the key to the sitemapamic:clear utility. Note, you can also pass the full cache key from the list command, such as sitemapamic.pages.

1php please sitemapamic:clear pages

You can also clear multiple keys at once. To clear the sitemap_blog.xml and sitemap_blog_tags.xml sub-sitemaps, pass blog and blog_tags as space-separated keys to the sitemapamic:clear utility:

1php please sitemapamic:clear blog blog_tags