architecture-center
architecture-center copied to clipboard
Cross correlated blog post Id starts from 2
The Use tags to cross-correlate cached items section has a code example that starts the blogKey = 1
, but there is a blogKey++
before it is cached for the first time, making it start from 2.
Later there are examples that use the key "blog:posts:1:tags", the will never exist.
List<string[]> tags = new List<string[]>
{
new[] { "iot","csharp" },
new[] { "iot","azure","csharp" },
new[] { "csharp","git","big data" },
new[] { "iot","git","database" },
new[] { "database","git" },
new[] { "csharp","database" },
new[] { "iot" },
new[] { "iot","database","git" },
new[] { "azure","database","big data","git","csharp" },
new[] { "azure" }
};
List<BlogPost> posts = new List<BlogPost>();
int blogKey = 1;
int numberOfPosts = 20;
Random random = new Random();
for (int i = 0; i < numberOfPosts; i++)
{
blogKey++;
posts.Add(new BlogPost(
blogKey, // Blog post ID
string.Format(CultureInfo.InvariantCulture, "Blog Post #{0}",
blogKey), // Blog post title
random.Next(100, 10000), // Ranking score
tags[i % tags.Count])); // Tags--assigned from a collection
// in the tags list
}
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: be785717-ca5e-f3d6-8e60-4005d9503d08
- Version Independent ID: 3ce414e5-d923-0488-ff11-3aa8bd4c2d1e
- Content: Caching guidance - Azure Architecture Center
- Content Source: docs/best-practices/caching.yml
- Service: architecture-center
- Sub-service: azure-guide
- GitHub Login: @EdPrice-MSFT
- Microsoft Alias: architectures
@cassiot Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.
#please-close