Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
geektutu committed Mar 14, 2020
1 parent 853df56 commit 0eb57c0
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 43 deletions.
9 changes: 4 additions & 5 deletions gee-cache/day1-lru/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day2-single-node/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day3-http-server/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day4-consistent-hash/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day5-multi-nodes/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day6-single-flight/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/day7-proto-buf/geecache/lru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
9 changes: 4 additions & 5 deletions gee-cache/doc/geecache-day1.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,11 @@ func (c *Cache) Add(key string, value Value) {
kv := ele.Value.(*entry)
c.nbytes += int64(value.Len()) - int64(kv.value.Len())
kv.value = value
return
} else {
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())
}
ele := c.ll.PushFront(&entry{key, value})
c.cache[key] = ele
c.nbytes += int64(len(key)) + int64(value.Len())

for c.maxBytes != 0 && c.maxBytes < c.nbytes {
c.RemoveOldest()
}
Expand Down
2 changes: 1 addition & 1 deletion gee-orm/day7-migrate/geeorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (engine *Engine) Migrate(value interface{}) error {

for _, col := range addCols {
f := table.GetField(col)
sqlStr := fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;", table.Name, f.Name, f.Tag)
sqlStr := fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;", table.Name, f.Name, f.Type)
if _, err = s.Raw(sqlStr).Exec(); err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion gee-orm/doc/geeorm-day7.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (engine *Engine) Migrate(value interface{}) error {

for _, col := range addCols {
f := table.GetField(col)
sqlStr := fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;", table.Name, f.Name, f.Tag)
sqlStr := fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s %s;", table.Name, f.Name, f.Type)
if _, err = s.Raw(sqlStr).Exec(); err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion gee-web/doc/gee-day3.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ github: https://github.com/geektutu/7days-golang

本文是 [7天用Go从零实现Web框架Gee教程系列](https://geektutu.com/post/gee.html)的第三篇。

- 使用 Tire 树实现动态路由(dynamic route)解析。
- 使用 Trie 树实现动态路由(dynamic route)解析。
- 支持两种模式`:name``*filepath`**代码约150行**

## Trie 树简介
Expand Down

0 comments on commit 0eb57c0

Please sign in to comment.