asp.net - c# Bundle Transform Break cache -


i create bundle transform modifies bundle content , triggers cache break, not able break cache.

so far have following code:-

public class bundleconfig {     public static void registerbundles(bundlecollection bundles)     {         stylebundle bundle = new stylebundle("~/content/global");         bundle.transforms.add(new cachebreaktransform());         bundle.include("~/css/main.css");         bundles.add(bundle);     } }  public class cachbreaktransform : ibundletransform {     void ibundletransform.process(bundlecontext context, bundleresponse response)     {         if(updateneeded())         {             response.content = getupdatedcontent(response.content);             //cache break needed here         }     } } 

i can update content of bundle, if file included in bundle hasn't changed bundle still cached , updated content not used. able break bundle cache updated content used.

two options

  1. set context.httpcontext.response.cache.setrevalidation

  2. setting response.cacheability nocache work, mean bundle never cached


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -