Limiting maximum size of cached responses

Is there any way to limit caching by response size, so responses won’t
be
cached if they exceed a maximum value?
E.g. Backend responses larger than 5mb won’t be cached.

Jader H. Silva