How to implement a memory transaction scope in C#?

邮差的信 提交于 2019-12-06 02:04:31

问题


we have a cache which I would like to put some transaction scopes around so that any process have to explicitly 'commit' the changes it wants to do to the cached objects and make it possible to rollback any changes when the process fails halfway as well.

Right now, we're deep cloning the cached objects on get requests, it works but it's not a clean solution and involves a fair bit of maintenance too.

I remember hearing about some MTS (memory transaction scope) solution on .NetRocks a while back but can't remember the name of it! Does anyone know of a good MTS framework out there? Alternatively, if I was to implement my own, are there any good guidelines/patterns on how to do this?

Thanks,

EDIT : got my abbreviation completely wrong! It should have been STM, Software Transaction Memory


回答1:


It sounds like you're remembering the discussion of Software Transactional Memory from .NET Rocks.

Unfortunately, there isn't a released, working, usable framework for this (yet). This is still a research project in DevLabs (STM.NET).

At this point in time, your cloning option is probably still the best approach, at least for any non-research or commercial application.



来源:https://stackoverflow.com/questions/2517917/how-to-implement-a-memory-transaction-scope-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!