MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / acquireLock

Method acquireLock

internal/repository/cache/post.go:447–449  ·  view source on GitHub ↗

辅助方法: 获取分布式锁

(ctx context.Context, lockKey string, expiration time.Duration)

Source from the content-addressed store, hash-verified

445
446// 辅助方法: 获取分布式锁
447func (c *postCache) acquireLock(ctx context.Context, lockKey string, expiration time.Duration) (bool, error) {
448 return c.client.SetNX(ctx, lockKey, "1", expiration).Result()
449}
450
451// 辅助方法: 释放分布式锁
452func (c *postCache) releaseLock(ctx context.Context, lockKey string) {

Callers 2

SetPubListMethod · 0.95
SetPubMethod · 0.95

Calls 1

SetNXMethod · 0.65

Tested by

no test coverage detected