mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-08 16:57:52 +01:00
fix (cache): fix concurrency issue where our mutex wasn't lock properly
This commit is contained in:
parent
762977190d
commit
a17dd11ce6
1 changed files with 2 additions and 2 deletions
|
|
@ -86,7 +86,7 @@ func NewKeyValueStore() KeyValueStore {
|
|||
return KeyValueStore{ cache: make(map[string]interface{}) }
|
||||
}
|
||||
|
||||
func (this KeyValueStore) Get(key string) interface{} {
|
||||
func (this *KeyValueStore) Get(key string) interface{} {
|
||||
this.Lock()
|
||||
val := this.cache[key]
|
||||
this.Unlock()
|
||||
|
|
@ -101,6 +101,6 @@ func (this *KeyValueStore) Set(key string, value interface{}) {
|
|||
|
||||
func (this *KeyValueStore) Clear() {
|
||||
this.Lock()
|
||||
defer this.Unlock()
|
||||
this.cache = make(map[string]interface{})
|
||||
this.Unlock()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue