resolveCacheStaticFilesResponses static method

bool resolveCacheStaticFilesResponses(
  1. bool? cache, {
  2. APIConfig? apiConfig,
})

Implementation

static bool resolveCacheStaticFilesResponses(bool? cache,
    {APIConfig? apiConfig}) {
  if (cache != null) return cache;

  if (apiConfig != null) {
    cache ??= apiConfig.getAs('cache-static-files-responses');
    cache ??= apiConfig.getAs('cache_static_files_responses');

    var entryCacheStaticFiles = apiConfig.getPath('cache', 'static_files');
    if (entryCacheStaticFiles is bool) {
      cache = entryCacheStaticFiles;
    }

    cache ??= apiConfig.getPath('cache', 'static_files', 'enabled');
  }

  cache ??= true;
  return cache;
}