anchor.diff:          | false -> ()
       result
   
  -
   let private loadTemplate templatePath =
       async {
         let writeTime = File.GetLastWriteTime(templatePath)
  
positive.code:       return writeTime, razorTemplate
      }
  
  let private memoize isValid f =
      let cache = Collections.Concurrent.ConcurrentDictionary<_ , _>()
      fun x ->
        async {
          match cache.TryGetValue(x) with
          | true, res when isValid x res -> return res
          | _ ->
              let! res = f x
              cache.[x] <- res
              return res
        }
  
  let private loadTemplateCached = 
      loadTemplate |> memoize (fun templatePath (lastWrite, _) -> File.GetLastWriteTime(templatePath) <= lastWrite )
  
  
  type private TemplateSource(templatePath:string) =
      interface ITemplateSource with
          member x.GetTemplateReader() = new StreamReader(templatePath) :> TextReader
          member x.Template =
              let template = async {
                  let! _,template = loadTemplateCached templatePath
                  return template.ToString()
              }
              template |> Async.RunSynchronously
              
          member x.TemplateFile = templatePath
  
  type private TemplateManager(basePath) =
      let mutable dynamicTemplates = System.Collections.Concurrent.ConcurrentDictionary()
      let x = fun a b -> (a +b+ 2)
      interface ITemplateManager with
          member x.AddDynamic(key, source) =
              dynamicTemplates.AddOrUpdate(key, source, (fun _ s -> s)) |> ignore
          member x.GetKey(name, resolveType, context) = NameOnlyTemplateKey(name, resolveType, context) :> ITemplateKey
          member x.Resolve(key) =
              match dynamicTemplates.TryGetValue(key) with
              | (true, template) -> template
              | _ ->           
                  let templatePath = resolvePath basePath key.Name
                  TemplateSource(templatePath) :> ITemplateSource
  
  let serviceConfiguration = TemplateServiceConfiguration()
  serviceConfiguration.DisableTempFileLocking <- true
  serviceConfiguration.CachingProvider <- new DefaultCachingProvider(fun t -> ())
  
  let razorService basePath =
      serviceConfiguration.TemplateManager <- TemplateManager(basePath)
      RazorEngineService.Create(serviceConfiguration)
  
  
  /// Renders partial content as empty string
  let empty<'a> = 
  
negative.code: 
  open System
  open System.Text.RegularExpressions
  open Suave.Utils.AsyncExtensions
  open System.Threading
  open Suave
  open System.IO
  open RazorEngine.Configuration
  