When does cache expire? (UID History)

we're using a variable called "slug" to identify different content pages.

we recently changed a slug's value from "siqterms" to "siq-terms". They both still resolve. Will the old slug expire and if so, when?

Hi @Alan-SpotHero, Prismic saves all previous UID (“slug” in your case) values for a given document. This way if the UID value is changed, old links aren’t broken.

You have a couple of options for this.

1. Setup a rerouting system (recommended)
For this, you just need to make a check in your routing system. If the UID used isn’t the current UID value, something like this:

if (uid !== document.uid)

Then redirect to the url that uses the current UID.

This will ensure that old links aren’t broken and that all old links will redirect to the current one.

2. Delete the old UID value
You can read more about this here:

​But basically you just need to duplicate the document, set the UID on the new document as you want. Then archive or delete the original. This will clear out any old UID values.


Thanks - I’ll bring this back to my engineers!

I can’t Duplicate document. I get a ‘clone disabled’ icon. Would like to do this so that I can then delete original thus removing old UID.

@outreach My guess is that your document is a “Single” type document. You (or someone else in your Prismic repo with admin rights) just need to edit the Custom Type for that document, change it from “Single” to “Repeatable”. Then you’ll be able to duplicate the document.

After you’re done with everything, then you can switch it back to “Single”.

That worked and was able to archive and old UID is not showing up anymore. But once you change from Single to Repeatable, I guess you can’t go back to Single because that option is disabled now.

That’s strange. Can you send me the following and I’ll look into it:

  • The url for your Prismic repository
  • The name of that Custom Type

If you don’t want to share that publicly, you can send it to me in a private message.

@outreach Thanks for sending that info. I took a look and the issue is that you need to fully delete the extra documents from your archive of that type before you can switch it back to a Singleton.

Here is an article that explains how to fully delete them:

This should solve the issue for you :grinning:

1 Like