]> git.lizzy.rs Git - go-fscache.git/blobdiff - cachelock.go
Replace obsolete lock package
[go-fscache.git] / cachelock.go
index 60861fcb8ad5b3f31c8d0ea85a08e5e2deea30e7..341b0fd3ff84548a495a1253e21c369c4debf8a5 100755 (executable)
@@ -1,16 +1,13 @@
 package fscache
 
 import (
-       "github.com/Kovensky/go-fscache/lock"
+       "github.com/gofrs/flock"
 )
 
 // Locks the file that backs the given key.
 //
 // If the call is successful, it's the caller's responsibility to call Unlock on the returned lock.
-func (cd *CacheDir) Lock(key ...CacheKey) (lock.FileLock, error) {
-       l, err := lock.LockFile(cd.cachePath(key...))
-       if l != nil {
-               l.Lock()
-       }
-       return l, err
+func (cd *CacheDir) Lock(key ...CacheKey) (*flock.Flock, error) {
+       l := flock.New(cd.cachePath(key...))
+       return l, l.Lock()
 }