PostValidator type is is introduced to implement the second part of the RFC about cache.
Q: What's the difference between this and a PreValidator? A: PreValidator runs BEFORE trying to get the cache, it cares only for the request
and if at least one PreValidator returns false then it just runs the original handler and stop there, at the other hand a PostValidator runs if all PreValidators returns true and original handler is executed but with a response recorder, also the PostValidator should return true to store the cached response. Last, a PostValidator accepts a http.ResponseWriter but internaly it should be `ResponseRecorder` in order to be able to catch the original handler's response, the PreValidator checks only for request.
If a function of type of PostValidator returns true then the (shared-always) cache is allowed to be stored.
PreValidator like middleware, executes before the cache action begins, if a callback returns false then this specific cache action, with specific request, is ignored and the real (original) handler is executed instead.
I'll not add all specifications here I'll give the oportunity (public API in the httpcache package-level) to the end-user to specify her/his ignore rules too (ignore-only for now).
Each package, nethttp and fhttp should implement their own encapsulations because of different request object.
One function, accepts the request and returns false if should be denied/ignore, otherwise true. if at least one return false then the original handler will execute as it's and the whole cache action(set & get) should be ignored, it will be never go to the step of post-cache validations.
Rule a superset of validators
Chained returns a new rule which has more than one coming next ruleset
Conditional returns a new rule witch has conditionals
DefaultValidator returns a new validator which contains the default pre and post cache validators
Header returns a new rule witch claims and execute the post validations trough headers
HeaderClaim returns a header rule which cares only about claiming (pre-validation)
HeaderValid returns a header rule which cares only about valid (post-validation)
NotSatisfied returns a rule which allows nothing
Satisfied returns a rule which allows anything, it's usualy the last rule on chained rules if no next rule is given, but it can be used outside of a chain too as a default allow-all rule.
Validator receives the preValidators and postValidators and returns a new Validator rule