Append when the GeoFeed is retrieved and if it was generated from in memory cache
This commit is contained in:
@@ -55,10 +55,12 @@ namespace AS1024.GeoFeed.MinimalAPI
|
||||
IMemoryCache memoryCache,
|
||||
IWebHostEnvironment environment)
|
||||
{
|
||||
bool isCached = true;
|
||||
try
|
||||
{
|
||||
if (!memoryCache.TryGetValue("Geofeed", out List<IPGeoFeed>? feed))
|
||||
{
|
||||
isCached = false;
|
||||
feed = await provider.GetGeoFeedData();
|
||||
if (environment.IsProduction())
|
||||
{
|
||||
@@ -68,7 +70,7 @@ namespace AS1024.GeoFeed.MinimalAPI
|
||||
}
|
||||
}
|
||||
|
||||
return Results.File(Encoding.UTF8.GetBytes(feed.ToGeoFeedCsv()),
|
||||
return Results.File(Encoding.UTF8.GetBytes(feed.ToGeoFeedCsv(true, isCached)),
|
||||
"text/csv",
|
||||
"geofeed.csv");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user