mirror of
https://github.com/gopl-zh/gopl-zh.github.com.git
synced 2024-11-24 15:18:57 +00:00
Merge branch 'master' of github.com:gopl-zh/gopl-zh.github.com
This commit is contained in:
commit
da5d8dda79
@ -163,7 +163,8 @@ type Memo struct {
|
||||
|
||||
// Get is concurrency-safe.
|
||||
func (memo *Memo) Get(key string) (value interface{}, err error) {
|
||||
res, ok := memo.cache[key] if!ok{
|
||||
res, ok := memo.cache[key]
|
||||
if !ok {
|
||||
res.value, res.err = memo.f(key)
|
||||
memo.cache[key] = res
|
||||
memo.mu.Lock()
|
||||
|
Loading…
Reference in New Issue
Block a user