VaryByCustom has always confused me, basically its just a string so if you use multiple values you have to split them up yourself in GetVaryByCustomString.
Ended up doing this in my overridden GetVaryByCustomString
string val = base.GetVaryByCustomString(context, "path");
(if i instead send in the complete custom string with my addon this returns null)
I then append my own custom value to "val" and that seems to work.
I need to implement custom caching, I do this by overriding getvarybycustomstring in global.asax and adding my key to web.config. The problem is that the default key is "path" and when I debug getvarybycustomstring this returns the current url-path. However when I add my own key to web.config "path,mykey" getvarybycustomstring returns null, so it seems to disable caching on path which seems bad?