MemoryCache Thread Safety, Is Locking Necessary?

前端 未结 7 643
你的背包
你的背包 2020-12-07 18:34

For starters let me just throw it out there that I know the code below is not thread safe (correction: might be). What I am struggling with is finding an implementation that

7条回答
  •  青春惊慌失措
    2020-12-07 18:36

    Just uploaded sample library to address issue for .Net 2.0.

    Take a look on this repo:

    RedisLazyCache

    I'm using Redis cache but it also failover or just Memorycache if Connectionstring is missing.

    It's based on LazyCache library that guarantees single execution of callback for write in an event of multi threading trying to load and save data specially if the callback are very expensive to execute.

提交回复
热议问题