Search code examples
c#asp.netlockingdistributed-cachingncache

Using distributed cache for locking


I'm currently looking to move the caching of my website over to NCache to allow availability, however in my code there are cases which need locking to guarantee data correctness.

I've read that one way of solving this is to use locking on the database level, but this looks pretty complicated.

Is it a reasonable solution to build my own locking system using the distributed cache? Or is this ill-advised?


Solution

  • Since you're already using NCache, why not use its Locking feature ?

    You can find the documentation here

    and an article over here