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

Sitemap data is cached forever with no option to clear it #78

Open
tomaszmadeyski opened this issue May 19, 2023 · 0 comments
Open

Sitemap data is cached forever with no option to clear it #78

tomaszmadeyski opened this issue May 19, 2023 · 0 comments

Comments

@tomaszmadeyski
Copy link

With the following values in the configuration:

services.AddSitemaps(x =>
{
      x.EnableLanguageDropDownInAdmin = true;
      x.EnableRealtimeCaching = true;
      x.EnableRealtimeSitemap = true;
});

sitemap data is being cached forever due to the fact that the CacheEvictionPolicy is set to null (if I'm not a googleBot):

https://github.com/Geta/geta-optimizely-sitemaps/blob/master/src/Geta.Optimizely.Sitemaps/Controllers/GetaSitemapController.cs#L109

var cachePolicy = isGoogleBot
            ? new CacheEvictionPolicy(TimeSpan.Zero,
                                      CacheTimeoutType.Sliding,
                                      new[] { _contentCacheKeyCreator.VersionKey })
            : null;
CacheManager.Insert(cacheKey, sitemapData.Data, cachePolicy);

I think it would be reasonable to cache it for some limited period - maybe 1 day or maybe 1 day by default with an option to overwrite this value in configuration?

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

No branches or pull requests

2 participants