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.

2 Likes

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