Add custom cache key functionality

Adds the option to set a custom cache key to be used instead of the uri based one.
I hope this is alright. Should be similar to the last PR that was made for this. I am new to writing tests and feedback is very welcome. If something should be changed comment please.

Thanks