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.

1 Like

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