-
-
Save ElakkuvanR/881528045bb488e9fc78c77ffbba9a5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Http; | |
| using Sitecore.LayoutService.Client.Request; | |
| namespace Mvp.Foundation.CustomMiddleware.Extension | |
| { | |
| public static class HttpRequestExtension | |
| { | |
| public static string GenerateCacheKeyForHttpRequest(this SitecoreLayoutRequest request) | |
| { | |
| string format = "{0}-{1}-{2}"; | |
| object item = string.Empty; | |
| object lang = string.Empty; | |
| object site = string.Empty; | |
| if (request.TryGetValue("item", out item) | |
| && request.TryGetValue("sc_lang", out lang) | |
| && request.TryGetValue("sc_site", out site)) | |
| return string.Format(format, site, item, lang).ToLower().Replace("/", "-"); | |
| return string.Empty; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment