CacheResponse attribute parameters set at run time

Hi,
I’m reading here

the new attribute based caching approach in SS, as an alternative to the ToOptimizedResult approach.

Question is: Can I add such attribute dynamically (addAttribute method) to a service method to avoid hard-coding its settings in code ?

thank you
Enrico

You can add this attribute dynamically, but you’d also have more control by just replicating what the CacheResponseAttribute does and populating the CacheInfo object instead:

req.Items[Keywords.CacheInfo] = cacheInfo;