Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom decoding/encoding to fileStorage #3225

Conversation

oskarek
Copy link
Contributor

@oskarek oskarek commented Jul 7, 2024

This PR generalizes the fileStorage persistence key so that it can be used with values that are not Codable, by adding the ability to provide custom decode/encode closures as parameters. Also, for Codable values, the json decoder/encoder can now be customized.

@Alex293
Copy link
Contributor

Alex293 commented Jul 8, 2024

I had a recent need to do some cache validation before retrieving the value (drop the file if it was created before some date). I wonder if instead of just focusing on codable this should go as far for loading/writing from/to URL.

I'd love to ear about how to make a composable wrapper to handle caching too

@stephencelis
Copy link
Member

@oskarek Thanks for taking the time to PR! We do think that supporting more than JSON is a good idea but haven't had time to review yet and think about the API. Hopefully soon!

Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just discussed and this looks good to us, thanks @oskarek!

@stephencelis stephencelis merged commit 1b627dc into pointfreeco:main Jul 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants