> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Lock API Reference

Distributed mutual exclusion feature




This service is designed to achieve exclusivity.

GS2-Lock acquires locks on a "mutex" resource identified by a combination of "namespace", "user ID", and "property ID".

For the property ID, you specify an arbitrary string that uniquely identifies the resource you want to mutually exclude. For example, a usage pattern is to assign a different property ID per process you want to avoid double-executing, such as "gacha drawing process", "item count update", or "external integration notification".

A transaction ID is specified when acquiring a lock. If the same transaction ID acquires a lock on the same mutex recursively, the reference count is incremented and it behaves as a reentrant lock. The lock is fully released only when Unlock is executed the same number of times.

A TTL (Time To Live) can be set on a lock, and the lock is automatically released after the TTL elapses.

Because GS2-Lock is provided as a GS2 microservice, you can implement common mutual exclusion across multiple titles, multiple backend servers, and multiple regions.

You can also call it from GS2-Script to perform mutual exclusion between the internals of server-side scripts and other script executions or external processes.

[Introduction to Microservices / GS2-Lock](../../microservices/lock)



- [GS2-Lock Deploy/CDK Reference](/api_reference/lock/deploy/)
  
- [GS2-Lock SDK API Reference](/api_reference/lock/sdk/)
  
- [GS2-Lock SDK for Game Engine API Reference](/api_reference/lock/game_engine/)
  
