victorspringer / http-cache

High performance Golang HTTP middleware for server-side application layer caching, ideal for REST APIs
https://godoc.org/github.com/victorspringer/http-cache
MIT License
339 stars 63 forks source link

Hooks to add observability? #7

Open hairyhenderson opened 4 years ago

hairyhenderson commented 4 years ago

Hi @victorspringer, first of all - thanks for a great project. http-cache is simple to use and has met all of my needs so far!

Recently I've been trying to gain more insight into the performance of one of my applications, and especially to figure out just how much impact the cache is having. I've been able to gather some simple metrics by shimming in an adapter, but there's significant context lost.

I'm wondering if you'd be open to expanding the API a bit to run some optional "observer" functions at certain times? I'm thinking specifically it would be useful to get a handle on the request or at least the request's context even in the case of a cache hit.

I'm willing to submit a PR for this work, but wanted to get your feedback first to see if this is something you're even interested in!