Skip to content

Commit f3242e6

Browse files
committed
feat(config): add country service cache duration configuration
- Introduce new environment configuration parameter for country service cache duration - Default cache duration is set to 15 minutes if not specified or parsing fails - New method `countryServiceCacheDuration` added to `EnvironmentConfig` class
1 parent 697cf26 commit f3242e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/src/config/environment_config.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,14 @@ abstract final class EnvironmentConfig {
172172
int.tryParse(_env['RATE_LIMIT_DATA_API_WINDOW_MINUTES'] ?? '60') ?? 60;
173173
return Duration(minutes: minutes);
174174
}
175+
176+
/// Retrieves the cache duration in minutes for the CountryQueryService.
177+
///
178+
/// The value is read from the `COUNTRY_SERVICE_CACHE_MINUTES` environment
179+
/// variable. Defaults to 15 minutes if not set or if parsing fails.
180+
static Duration get countryServiceCacheDuration {
181+
final minutes =
182+
int.tryParse(_env['COUNTRY_SERVICE_CACHE_MINUTES'] ?? '15') ?? 15;
183+
return Duration(minutes: minutes);
184+
}
175185
}

0 commit comments

Comments
 (0)