Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate the cache manually ? #238

Open
haja-ran opened this issue Jan 27, 2022 · 3 comments
Open

Regenerate the cache manually ? #238

haja-ran opened this issue Jan 27, 2022 · 3 comments

Comments

@haja-ran
Copy link

First of all, thanks for the great work !

I’m working on a large project with lots of dynamic routes. The API requests to fetch the dynamic routes are quite slow (sometimes more than 15s) because of the sheer number of URLs.

Is there a way to regenerate the cache manually (instead of waiting for robots to visit the sitemap url) ?

I would like to set a longer cache time so that I can use something like a cron job on the server side to ping a private URL that would regenerate the cache before it becomes invalid.

Is there a way I can achieve that or something similar ?

@mathiasrando
Copy link

@haja-ran Did you ever figure out a way to do this?

@haja-ran
Copy link
Author

haja-ran commented Nov 9, 2022

@mathiasrando I ended up creating a cron job that copies the resulting xml files from the node server to Amazon S3 every 6 hours. Then I updated the robots.txt file so that the sitemap points to the static files in S3.

@mathiasrando
Copy link

@haja-ran Thanks for the very swift reply. I haven't been able to find anyone who've managed to regenerate it without restarting Nuxt or bombarding some endpoint checking for the "freshness" of the current sitemap by reducing the cache time to 1ms.

That sounds like a reasonable solution. For our specific setup I think we'll go with writing new files whenever a specific request hits the middleware in Nuxt. Then we'll trigger the request when changes in the CMS should result in updating the sitemap(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants