MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / getScopedLocks

Method getScopedLocks

diskcache/file_cache.go:91–103  ·  view source on GitHub ↗

getScopedLocks pull lock from the map if found or create a new one

(key string)

Source from the content-addressed store, hash-verified

89
90// getScopedLocks pull lock from the map if found or create a new one
91func (f *FileCache) getScopedLocks(key string) (lock sync.Locker) {
92 f.scopedLocks.Do(func() { f.scopedLocks.locks = map[string]sync.Locker{} })
93
94 f.scopedLocks.Lock()
95 lock, ok := f.scopedLocks.locks[key]
96 if !ok {
97 lock = &sync.Mutex{}
98 f.scopedLocks.locks[key] = lock
99 }
100 f.scopedLocks.Unlock()
101
102 return lock
103}
104
105func (f *FileCache) getFileName(key string) string {
106 hasher := sha1.New()

Callers 2

StoreMethod · 0.95
DeleteMethod · 0.95

Implementers 2

NoOpdiskcache/noop_cache.go
FileCachediskcache/file_cache.go

Calls

no outgoing calls

Tested by

no test coverage detected