Skip to content

Commit

Permalink
Update cache duration for API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Apr 26, 2024
1 parent a68b94a commit ff39fb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/FunderMaps.WebApi/Controllers/GeocoderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed class GeocoderController(GeocoderTranslation geocoderTranslation)
/// Get address by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. Addresses will not change often.
/// Cache response for 12 hours. Addresses will not change often.
/// </remarks>
[HttpGet("address/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<Address> GetAddressAsync(string id)
Expand All @@ -28,7 +28,7 @@ public Task<Address> GetAddressAsync(string id)
/// Get building by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. Building will not change often.
/// Cache response for 12 hours. Building will not change often.
/// </remarks>
[HttpGet("building/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<Building> GetBuildingAsync(string id)
Expand All @@ -50,7 +50,7 @@ public Task<Neighborhood> GetNeighborhoodAsync(string id)
/// Get district by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. District will not change often.
/// Cache response for 12 hours. District will not change often.
/// </remarks>
[HttpGet("district/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<District> GetDistrictAsync(string id)
Expand All @@ -61,7 +61,7 @@ public Task<District> GetDistrictAsync(string id)
/// Get municipality by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. Municipality will not change often.
/// Cache response for 12 hours. Municipality will not change often.
/// </remarks>
[HttpGet("municipality/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<Municipality> GetMunicipalityAsync(string id)
Expand All @@ -72,7 +72,7 @@ public Task<Municipality> GetMunicipalityAsync(string id)
/// Get state by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. State will not change often.
/// Cache response for 12 hours. State will not change often.
/// </remarks>
[HttpGet("state/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<State> GetStateAsync(string id)
Expand All @@ -83,7 +83,7 @@ public Task<State> GetStateAsync(string id)
/// Get geocoder information by identifier.
/// </summary>
/// <remarks>
/// Cache response for 8 hours. Building will not change often.
/// Cache response for 12 hours. Building will not change often.
/// </remarks>
[HttpGet("{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public async Task<GeocoderInfo> GetAsync(string id)
Expand Down
10 changes: 8 additions & 2 deletions src/FunderMaps.WebApi/Controllers/Model/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ public sealed class ProductController(ModelService modelService) : FunderMapsCon
/// <summary>
/// Request the analysis product.
/// </summary>
[HttpGet("analysis/{id}")]
/// <remarks>
/// Cache response for 12 hours. Analysis will not change often.
/// </remarks>
[HttpGet("analysis/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<AnalysisProduct> GetAnalysisAsync(string id)
=> modelService.GetAnalysisAsync(id, TenantId);

// GET: api/product/statistics
/// <summary>
/// Request the statistics product.
/// </summary>
[HttpGet("statistics/{id}")]
/// <remarks>
/// Cache response for 12 hours. Statistics will not change often.
/// </remarks>
[HttpGet("statistics/{id}"), ResponseCache(Duration = 60 * 60 * 12)]
public Task<StatisticsProduct> GetStatisticsAsync(string id)
=> modelService.GetStatisticsAsync(id, TenantId);
}

0 comments on commit ff39fb0

Please sign in to comment.