Skip to content

Make DialCacheConfig modes discriminated and explicit #19

Closed

Description

@lan17

Priority

P2 — Medium — completed by the observability and Redis-ownership simplifications.

Original problem

Earlier versions exposed overlapping constructor modes: Redis accepted either a direct client or lazy factory, while core metrics mixed disabled/custom modes with Prometheus-specific configuration.

Resolution

The ambiguous modes no longer exist:

  • feat: decouple Prometheus metrics adapter #56 reduced core observability to one optional caller-supplied DialCacheMetricsAdapter. Omission disables instrumentation; vendor configuration lives in dialcache/prometheus and dialcache/datadog.
  • feat: require caller-owned Redis clients #67 removed RedisConfig.createClient and RedisClientFactory. RedisConfig.client is now required and caller-owned.
  • Plain JavaScript/untyped callers receive explicit runtime migration errors for the removed Redis factory and key-prefix modes, where silently changing resource ownership or cache identity would be unsafe.
  • TypeScript and packed ESM/CommonJS declaration consumers reject the removed metrics options and assert the direct-client requirement, backend-neutral metrics shape, and absence of vendor factories from the root package.

Current evidence:

No further discriminated-union layer is needed: the remaining constructor properties are orthogonal optional capabilities, and Redis itself has one unambiguous required client mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions