Skip to content

feat: intent-based cache API (CacheKit::minimal, ::production, ::secure, ::io) #13

@27Bslash6

Description

@27Bslash6

Context

Python and TypeScript SDKs now have intent-based factory functions that pre-configure the full cache stack from a single declarative call:

Python: @cache.minimal(), @cache.production(), @cache.secure(), @cache.io()
TypeScript: createCache.minimal(), .production(), .secure(), .io() (cachekit-io/cachekit-ts#1)

The Rust SDK is the only one missing this pattern.

Proposal

Add intent-based builder methods:

// Speed-first — no circuit breaker, minimal config
let cache = CacheKit::minimal("redis://localhost:6379")
    .ttl(300)
    .build()?;

// Reliability-first — circuit breaker + retry
let cache = CacheKit::production("redis://localhost:6379")
    .ttl(600)
    .build()?;

// Zero-knowledge encryption
let cache = CacheKit::secure("redis://localhost:6379")
    .master_key(key)
    .build()?;

// SaaS backend
let cache = CacheKit::io()
    .api_key("ck_live_...")
    .ttl(3600)
    .build()?;

Intent Specifications

Intent Backend Circuit Breaker Retry L1 SWR Encryption Default TTL
minimal Redis Off Off Off No 300s
production Redis On (threshold: 5) On On No 600s
secure Redis On (threshold: 5) On On AES-256-GCM 600s
io cachekit.io On (threshold: 5) On On Optional 3600s

References

  • Python implementation: cachekit-py/src/cachekit/decorators/intent.py
  • TypeScript implementation: cachekit-ts/packages/cachekit/src/intents.ts
  • SDK feature matrix: protocol/sdk-feature-matrix.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions