Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. WCF with MemoryCaching

WCF with MemoryCaching

Scheduled Pinned Locked Moved WCF and WF
csharphtmldatabasewcfcom
3 Posts 2 Posters 27 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jorgen Andersson
    wrote on last edited by
    #1

    I need to create a WCF service that's going to do some pretty heavy database querying that I therefore want to cache. (System.Runtime.Caching) For performance reasons it should also be multithreaded. If I would set Instance Context Mode to PerCall I can't use MemoryCaching since the cache is recreated with every instance. If I would set Instance Context Mode to Single and Concurrency Mode to Multiple, Caching would work just fine but I would need to make everything threadsafe. Have I understood everything right? Any better recommendations?

    Wrong is evil and must be defeated. - Jeff Ello

    S 1 Reply Last reply
    0
    • J Jorgen Andersson

      I need to create a WCF service that's going to do some pretty heavy database querying that I therefore want to cache. (System.Runtime.Caching) For performance reasons it should also be multithreaded. If I would set Instance Context Mode to PerCall I can't use MemoryCaching since the cache is recreated with every instance. If I would set Instance Context Mode to Single and Concurrency Mode to Multiple, Caching would work just fine but I would need to make everything threadsafe. Have I understood everything right? Any better recommendations?

      Wrong is evil and must be defeated. - Jeff Ello

      S Offline
      S Offline
      Shoaib
      wrote on last edited by
      #2

      I assume you are talking about using ASP.NET Cache object in WCF services (w/ AspNetCompatibilityMode) but I don't quite get this "can't use MemoryCaching since the cache is recreated with every instance" ASP.NET cache will remain as long as the Application remains (which can be configured not to be re-cycled). Have a look at NCache Express or any other caching framework including memcached.

      J 1 Reply Last reply
      0
      • S Shoaib

        I assume you are talking about using ASP.NET Cache object in WCF services (w/ AspNetCompatibilityMode) but I don't quite get this "can't use MemoryCaching since the cache is recreated with every instance" ASP.NET cache will remain as long as the Application remains (which can be configured not to be re-cycled). Have a look at NCache Express or any other caching framework including memcached.

        J Offline
        J Offline
        Jorgen Andersson
        wrote on last edited by
        #3

        .Shoaib wrote:

        I assume you are talking about using ASP.NET Cache object

        No, as I specified I am talking about System.Runtime.Caching. The problem with using Asp.Net caching is twofold. First AspNetCompatibilityMode is slow, secondly it only works if WCF service is hosted inside IIS and uses an HTTP-based binding. Which by the way also is slow. I'm aiming to use Net.Tcp binding.

        Wrong is evil and must be defeated. - Jeff Ello

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups