http_cache_core

1.1.4

HTTP cache core models, pivot package for agnostic HTTP client implementation.

Download archive

Readme

Common HTTP cache models and utils for dio_cache_interceptor & http_cache_client with associated stores.

Changelog

1.1.4

  • perf: DeepCollectionEquality to static const in CacheResponse and CacheControl.
  • perf: memoize getHeaders() to avoid repeated JSON decode per isExpired() call.
  • fix: treat bare max-stale (no delta) as accept any age.
  • fix: skip non-token Cache-Control directives instead of throwing.
  • fix: deduplicate getFromPath results by key instead of value equality.
  • fix: guard against whitespace-only and trailing-comma Cache-Control values.
  • fix: include If-None-Match to prevent bypassing client conditionals.
  • fix: enforce allowedStatusCodes in _isCacheable to prevent caching error responses.
  • chore: Update dependencies.
  • fix: anchor regex to prevent substring mismatches.
  • fix: treat max-age=0 as a cache directive in _hasCacheDirectives.
  • fix: move If-Modified-Since removal out of _hasConditions predicate.
  • fix: guard HttpDate.parse against malformed Last-Modified.
  • fix: CacheResponse.hashCode violated hash/equals contract for List fields.
  • fix: repair LRU linked-list corruption when removing a middle node.
  • chore: Min SDK is now 3.6.0.

1.1.3

  • fix: Allow optional whitespace in header values.

1.1.2

  • fix: Allow keyBuilder to depend on request body.

1.1.1

  • fix: Send only one condition on request cache validation.
  • fix: BaseRequest now has headers getter instead of headerValuesAsList.
  • fix: 302 & 307 codes handling.

1.1.0

  • feat: Early skip strategy calculation when request has already cache check conditions.
  • feat: Better handling of headers.
  • feat: Clamp cache-control values and other headers.
  • fix: Regression from versions 1.0.1 with CacheOptions#maxStale inverted behaviour.
  • chore: Add more comments.
  • chore: Add more tests & fix some.

1.0.2

  • fix: Enforce CacheKeyBuilder headers as map of String values instead of dynamic.

1.0.1

  • chore: Add writeContent to CacheResponse.
  • fix: CacheOptions#maxStale usage may lead to empty response body.
  • chore: Allow to read only headers or body.

1.0.0

  • Initial version.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add http_cache_core
pubspec.yaml
name: http_cache_core
description: HTTP cache core models, pivot package for agnostic HTTP client implementation.
version: 1.1.4
homepage: https://github.com/llfbandit/dart_http_cache/tree/master/http_cache_core
repository: https://github.com/llfbandit/dart_http_cache/tree/master/http_cache_core
issue_tracker: https://github.com/llfbandit/dart_http_cache/issues

resolution: workspace

environment:
  sdk: ^3.8.0

dependencies:
  # https://pub.dev/packages/collection
  collection: ^1.17.2
  # https://pub.dev/packages/string_scanner
  string_scanner: ^1.2.0
  # https://pub.dev/packages/uuid
  uuid: ^4.5.0

dev_dependencies:
  lints: ^6.1.0
  test: ^1.24.4

  http_cache_store_tester: ^1.0.0

Version history

VersionPublishedArchiveSHA-256
1.0.0On demandDownload14fb2b54…c9c6e2
1.0.1On demandDownload77203b24…8f5fdc
1.0.2On demandDownloadaff365ce…a05b6a
1.1.0On demandDownload29f36776…85a623
1.1.1On demandDownloadb0accfa8…10cfe1
1.1.2On demandDownload8f9f187d…338071
1.1.3On demandDownloadff0b6e6c…bee511
1.1.4Cached · Upstream SHA-256 matchedDownloadd6de4ca6…04eddf

Dependencies

collection "^1.17.2"

string_scanner "^1.2.0"

uuid "^4.5.0"