stack allocate the cache key for weather
This commit is contained in:
parent
f936422b07
commit
50e493aad5
1 changed files with 2 additions and 2 deletions
|
|
@ -23,8 +23,8 @@ pub const VTable = struct {
|
|||
|
||||
pub fn fetch(self: WeatherProvider, allocator: std.mem.Allocator, coords: Coordinates) !types.WeatherData {
|
||||
// Generate cache key from coordinates
|
||||
const cache_key = try std.fmt.allocPrint(allocator, "{d:.4},{d:.4}", .{ coords.latitude, coords.longitude });
|
||||
defer allocator.free(cache_key);
|
||||
var buf: [256]u8 = undefined;
|
||||
const cache_key = try std.fmt.bufPrint(&buf, "{d:.4},{d:.4}", .{ coords.latitude, coords.longitude });
|
||||
|
||||
// Check cache first
|
||||
if (self.cache.get(cache_key)) |cached_raw|
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue