charitywater/puffing-billy — pull request #1 by bprotas (2014-11-13 15:20:16+00:00)
Title: Add custom key generator configuration option

- Sometimes the options provide by ignore_params etc don't provide enough control; some sites just do weird things
- To give the implementor more control in determining how a given request should be hashed for caching purposes, create a new Billy config option called key_generators
- Key generators is a hash, keyed by host, of lambdas or procs that receive 3 parameters - HTTP method, URL, and body - and returns either a string to use as the hash key for that parameter, or nil, in which case the existing default hash is generated
- It is left up to the implementor to make sure that these generators return something reasonable to be used in a filename for the cache, and to return the appropriate key for a given request (i.e., to make sure that the same requests return the same keys so they are cached correctly, etc)