Cache TTL set by the client

Hi,

Is it possible somehow to let the cache ttl (in proxy_pass caching) be
defined by the client?

Unfortunately it looks like proxy_cache_valid doesn’t accept variables
as input.

Thank you in advance.