Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit fff730b

Browse files
committed
Aggiornata documentazione RedisCache
1 parent 11c8944 commit fff730b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/NET6CustomLibrary/Docs/README-RedisCache.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,18 @@ public class ExampleController : ControllerBase
5050
{
5151
logger.LogInformation("GetMyListType");
5252

53-
var cache = cacheService.GetCache<List<MyListType>>("ListType");
53+
var lista = new List<MyListType>();
54+
var recordKey = $"MyListType_{SequentialGuidGenerator.Instance.NewGuid()}";
5455

55-
if (cache != null)
56-
{
57-
return cache;
58-
}
59-
else
56+
lista = await cacheService.GetCacheAsync<List<MyListType>>(recordKey);
57+
58+
if (lista is null)
6059
{
61-
var result = await myService.GetMyListTypeAsync();
62-
return cacheService.SetCache("ListType", result);
60+
lista = await utilityService.GetMyListTypeAsync();
61+
await cacheService.SetCacheAsync(recordKey, lista);
6362
}
63+
64+
return lista;
6465
}
6566
}
6667
```

0 commit comments

Comments
 (0)