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

Feat: introduce redis-json cachified adapter #73

Closed tearingItUp786 closed 10 months ago

tearingItUp786 commented 11 months ago

Issue Link Describing the Request

Introduce the redis json like cache adapter. I was unable to find a redis-json-mock library for us to use so I opted to follow the pattern that exists in the current adapters.ts and created a RedisJsonLikeCache

I have a similar implementation on my own site that you can reference.

Side note: sorry for the MIA -- got busy with life 🙇.

codecov-commenter commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (b1dbccd) 100.00% compared to head (8f16851) 100.00%. Report is 2 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #73 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 12 12 Lines 450 468 +18 Branches 149 154 +5 ========================================= + Hits 450 468 +18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kentcdodds commented 10 months ago

Hello! I'm taking over as the primary maintainer. One thing I'd like to do is keep adapters out of this package and instead have them be their own package and we can simply add a reference in the docs. That will help us avoid unnecessary breaking change releases due to adapters needing to change.

Would you be interested in making an adapter package with @epic-web/cachified as a peer dependency and then making a PR to link to your package?

tearingItUp786 commented 10 months ago

Hey @kentcdodds 👋🏽! Sure; sounds like fun! Have never set up a package/deployed anything to NPM but no time like the present. For this new package, are you wanting to have it under the same namespace such as @epic-web/cachified-adapters?

kentcdodds commented 10 months ago

I think it'd be best if you publish it yourself. You can namespace it under your own username on npm or just publish it without a namespace. I don't think a collection of adapters would be good. Instead, each adapter can be its own package. You could call this one cachified-redis-json to be descriptive 😅

The nice thing about this is you get complete control over the package and don't need anyone's permission to make changes as you see fit.

tearingItUp786 commented 10 months ago

Create a PR for the link to the new package! Will close this one