We have an action on a controller that normally shouldn't have any caching, but in a certain use case it's getting hammered a lot and it would be great to give it a cache of for example 5 seconds.
I know this could be solved by making two actions, one without caching and one with, but I was wondering if it's possible to set the cache duration as part of the request.
The idea is that when accessing /api/myController/myAction?id=1 you'd get a result back with no caching, but if you accessed /api/myController/myAction?id=1&cacheDuration=5 you'd set up 5 seconds of server cache for anyone accessing it with the cacheDuration=5 parameter.
We have an action on a controller that normally shouldn't have any caching, but in a certain use case it's getting hammered a lot and it would be great to give it a cache of for example 5 seconds.
I know this could be solved by making two actions, one without caching and one with, but I was wondering if it's possible to set the cache duration as part of the request.
The idea is that when accessing
/api/myController/myAction?id=1
you'd get a result back with no caching, but if you accessed/api/myController/myAction?id=1&cacheDuration=5
you'd set up 5 seconds of server cache for anyone accessing it with thecacheDuration=5
parameter.Is this doable somehow?