Lock Service
锁定
此服务允许脚本阻止对代码段的并发访问。如果您有多个用户或进程修改一个共享资源,并且希望防止发生冲突,这种做法将非常有用。
类
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-01。
[null,null,["最后更新时间 (UTC):2023-12-01。"],[[["The Lock service in Apps Script helps prevent conflicts when multiple users or processes access shared resources."],["It provides different types of locks: Document Lock, Script Lock, and User Lock, each controlling access at various levels."],["Locks can be acquired, released, and checked for status using methods like `tryLock`, `releaseLock`, and `hasLock`."],["Timeouts can be set while acquiring locks to avoid indefinite waiting using methods like `tryLock` and `waitLock`."]]],[]]