Dynamic cache expiration

akka-http

(Juan José Vázquez) #1

Hello there!. Is there currently a way to specify a custom logic to specify the ttl for an entry in Akka Http cache?. According to the documentation, it’s currently possible to define a global time to live policy but it doesn’t seem possible to set a dynamically computed ttl per entry.

I stumbled across a use case where this is neccessary: an endpoint that serves authorization tokens that carries expiration data. It’d be great to cache these tokens according to their particular ttl.

If this is not currently implemented, I’d be happy to contribute with code if you think this would be useful for the community.

Thanks!