Closed lox closed 7 years ago
I've added you as a contributor -- I do use this module in an internal project, but haven't had time to fully flesh it out beyond my short term needs. I think it is an OK start as a low level tool for a cache server, is there a specific direction you are thinking of going API wise?
Similar theory to yours, the underlying layer is parsing out attributes of the combination of request/response as an Analysis
:
https://github.com/lox/cachecontrol/blob/master/analyze.go#L34
This is designed to be light-weight and quick, been working on reducing allocations.
Then there is a higher-order API in the form of:
Analysis.IsStorable
Analysis.NeedsValidation
I'm also going to provide a Validator
for validating cached requests. The persistence element is left entirely out of scope, exactly like yours.
I've worked hard to keep it fast and lean, so should end up pretty faster after some optimization. The idea is for it to replace the guts of https://github.com/lox/httpcache and also power a number of other caching middlewares around the place.
I'm going to spend some more time on it, especially around documenting it. Would certainly be neat to try and figure out a way that we could consolidate, otherwise perhaps I need to think of a different name so as not to lead to confusion.
Ooops, it appears that I've created pretty much entirely the same library:
https://github.com/lox/cachecontrol
Any interest in combining / collaborating?