-
Notifications
You must be signed in to change notification settings - Fork 306
Expand file tree
/
Copy pathContactCacheKey.cs
More file actions
44 lines (42 loc) · 1.89 KB
/
ContactCacheKey.cs
File metadata and controls
44 lines (42 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//------------------------------------------------------------------------------
// <auto-generated>
// This file is part of the CleanArchitecture.Blazor project.
// Licensed to the .NET Foundation under the MIT license.
// See the LICENSE file in the project root for more information.
//
// Author: neozhu
// Created Date: 2025-03-13
// Last Modified: 2025-03-13
// Description:
// Defines static methods and properties for managing cache keys and expiration
// settings for Contact-related data. This includes creating unique cache keys for
// various contact queries (such as getting all contacts, contacts by ID, etc.),
// managing the cache expiration tokens to control cache validity, and providing a
// mechanism to refresh cached data in a thread-safe manner.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CleanArchitecture.Blazor.Application.Features.Contacts.Caching;
/// <summary>
/// Static class for managing cache keys and expiration for Contact-related data.
/// </summary>
public static class ContactCacheKey
{
public const string GetAllCacheKey = "all-Contacts";
public static string GetPaginationCacheKey(string parameters) {
return $"ContactCacheKey:ContactsWithPaginationQuery,{parameters}";
}
public static string GetExportCacheKey(string parameters) {
return $"ContactCacheKey:ExportCacheKey,{parameters}";
}
public static string GetByNameCacheKey(string parameters) {
return $"ContactCacheKey:GetByNameCacheKey,{parameters}";
}
public static string GetByIdCacheKey(string parameters) {
return $"ContactCacheKey:GetByIdCacheKey,{parameters}";
}
public static IEnumerable<string>? Tags => new string[] { "contact" };
public static void Refresh()
{
FusionCacheFactory.RemoveByTags(Tags);
}
}