epicweb-dev / cachified

🤑 wrap virtually everything that can store by key to act as cache with ttl/max-age, stale-while-validate, parallel fetch protection and type-safety support
MIT License
916 stars 26 forks source link

Optionally support zod validators #44

Closed Xiphe closed 1 year ago

Xiphe commented 1 year ago

The type-safety of the lib bases on the assumption that

  1. The types of a given key do not change
  2. Nothing else writes the the cache key
  3. Or checkValue is implemented and has no bugs.

All in all not the most robust foundation to build upon 🤔

Inspired by libs like trpc i thought maybe cachified could optionally use zod to validate types.

Not sure if this requires actual change or updating the recipe in readme is enough.