ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在MongoDB中使用悲观锁

在MongoDB中使用悲观锁

原创 Linux操作系统 作者:jieforest 时间:2012-10-25 19:59:54 0 删除 编辑
In this article, I’m going to sketch a pattern for implementing pessimistic locking with MongoDB. MongoDB is a document-orientated NoSQL datastore that does not support locking itself.

In some business processes it may be required that you have an exclusive access to a single document. That’s when you need something like pessimistic locking.

Requirements

The implementation should offer the following features:

Locking does not change the locked document itself

Locks can be removed manually or by a timeout

For the rest of this article, let’s assume we want to lock documents in a collection called workitem.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/301743/viewspace-747237/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: JCache API介绍
请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    441
  • 访问量
    602329