]> git.lizzy.rs Git - go-fscache.git/blob - cachelock.go
Add (*CacheDir).Chtime test
[go-fscache.git] / cachelock.go
1 package fscache
2
3 import (
4         "github.com/Kovensky/go-fscache/lock"
5 )
6
7 // Locks the file that backs the given key.
8 //
9 // If the call is successful, it's the caller's responsibility to call Unlock on the returned lock.
10 func (cd *CacheDir) Lock(key ...CacheKey) (lock.FileLock, error) {
11         l, err := lock.LockFile(cd.cachePath(key...))
12         if l != nil {
13                 l.Lock()
14         }
15         return l, err
16 }