Skip to content

range-labs/kvstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kvstore

Key-value store with DynamoDB backend and distributed lock support.

store := dynstore.New(dynamodb.New(sess), *dynamoTable)

// Set key
err = store.Set(key, value)

// Get key
var value string
err = store.Get(key, &value)

Distributed locks

kvstore Can be used to set up distributed locks:

// Attempto to acquire the lock.
clearLock, err := kvstore.AcquireExpiringLock(store, lockKey, 1*time.Minute)
if err != nil {
    // Another process has the lock.
    if err == kvstore.ErrFailedToAcquireLock {
        return nil
    }
    return err
}
defer func() {
    if err := clearLock(); err != nil {
      // Failed to clear the lock
    }
}()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages