Skip to content

Commit

Permalink
fix: enable building cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Sep 20, 2024
1 parent ce21a4c commit c32f80d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Public.Api/Building/Oslo/BuildingOsloController-Get.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ public async Task<IActionResult> GetBuildingV2(

RestRequest BackendRequest() => CreateBackendDetailRequest(objectId);

// As long as we do not control WFS, buildings cannot be cached
//var cacheKey = $"V2/building:{objectId}";
var cacheKey = $"oslo/building:{objectId}";

//var value = await (CanGetFromCache(actionContextAccessor.ActionContext)
// ? GetFromCacheThenFromBackendAsync(format, BackendRequest, cacheKey, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken)
// : GetFromBackendAsync(format, BackendRequest, Request.GetTypedHeaders(), CreateDefaultHandleBadRequest(), cancellationToken));

var value = await GetFromBackendAsync(
contentFormat.ContentType,
BackendRequest,
CreateDefaultHandleBadRequest(),
cancellationToken);
var value = await (CanGetFromCache(actionContextAccessor.ActionContext)
? GetFromCacheThenFromBackendAsync(
contentFormat.ContentType,
BackendRequest,
cacheKey,
CreateDefaultHandleBadRequest(),
cancellationToken)
: GetFromBackendAsync(
contentFormat.ContentType,
BackendRequest,
CreateDefaultHandleBadRequest(),
cancellationToken));

return new BackendResponseResult(value, BackendResponseResultOptions.ForRead());
}
Expand Down

0 comments on commit c32f80d

Please sign in to comment.