sync_cache.go

Go•マスター

Explorer

C40
C++40
C#40
Dart40
Go
初級10
中級10
上級10
エキスパート5
マスター5
context_timeout.go
generic_pool.go
worker_pool.go
reflect_map.go
sync_cache.go
Java40
JavaScript40
Kotlin40
Objective-C40
Perl40
PHP40
Python40
R40
Ruby40
Rust40
Shell40
Swift40
TypeScript40
sync_cache.go
Click to focus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
type Cache struct {↵
   sync.RWMutex↵
   data map[string]any↵
}↵
func (c *Cache) Get(key string) (any, bool) {↵
   c.RLock()↵
   defer c.RUnlock()↵
   v, ok := c.data[key]↵
   return v, ok↵
}↵
func (c *Cache) Set(key string, val any) {↵
   c.Lock()↵
   defer c.Unlock()↵
   c.data[key] = val↵
}
0WPM•0%•0:00•0/280(0%)|Ln 1, Col 1
UTF-8•Go

関連する練習問題