mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt miss
This commit is contained in:
parent
ff8ec94bf7
commit
ac26f735df
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
"github.com/shylinux/toolkits/log"
|
"github.com/shylinux/toolkits/logs"
|
||||||
"github.com/shylinux/toolkits/util/bench"
|
"github.com/shylinux/toolkits/util/bench"
|
||||||
"github.com/shylinux/toolkits/util/bench/redis"
|
"github.com/shylinux/toolkits/util/bench/redis"
|
||||||
|
|
||||||
|
8
data.go
8
data.go
@ -10,7 +10,7 @@ func (m *Message) Richs(key string, chain interface{}, raw interface{}, cb inter
|
|||||||
if cache == nil {
|
if cache == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return miss.Richs(m.Confm("miss", nil), kit.Keys(key, chain), cache, raw, cb)
|
return miss.Richs(kit.Keys(key, chain), cache, raw, cb)
|
||||||
}
|
}
|
||||||
func (m *Message) Rich(key string, chain interface{}, data interface{}) string {
|
func (m *Message) Rich(key string, chain interface{}, data interface{}) string {
|
||||||
cache := m.Confm(key, chain)
|
cache := m.Confm(key, chain)
|
||||||
@ -18,7 +18,7 @@ func (m *Message) Rich(key string, chain interface{}, data interface{}) string {
|
|||||||
cache = map[string]interface{}{}
|
cache = map[string]interface{}{}
|
||||||
m.Confv(key, chain, cache)
|
m.Confv(key, chain, cache)
|
||||||
}
|
}
|
||||||
return miss.Rich(m.Confm("miss", nil), kit.Keys(key, chain), cache, data)
|
return miss.Rich(kit.Keys(key, chain), cache, data)
|
||||||
}
|
}
|
||||||
func (m *Message) Grow(key string, chain interface{}, data interface{}) int {
|
func (m *Message) Grow(key string, chain interface{}, data interface{}) int {
|
||||||
cache := m.Confm(key, chain)
|
cache := m.Confm(key, chain)
|
||||||
@ -26,14 +26,14 @@ func (m *Message) Grow(key string, chain interface{}, data interface{}) int {
|
|||||||
cache = map[string]interface{}{}
|
cache = map[string]interface{}{}
|
||||||
m.Confv(key, chain, cache)
|
m.Confv(key, chain, cache)
|
||||||
}
|
}
|
||||||
return miss.Grow(m.Confm("miss", nil), kit.Keys(key, chain), cache, data)
|
return miss.Grow(kit.Keys(key, chain), cache, data)
|
||||||
}
|
}
|
||||||
func (m *Message) Grows(key string, chain interface{}, match string, value string, cb interface{}) map[string]interface{} {
|
func (m *Message) Grows(key string, chain interface{}, match string, value string, cb interface{}) map[string]interface{} {
|
||||||
cache := m.Confm(key, chain)
|
cache := m.Confm(key, chain)
|
||||||
if cache == nil {
|
if cache == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return miss.Grows(m.Confm("miss", nil), kit.Keys(key, chain), cache,
|
return miss.Grows(kit.Keys(key, chain), cache,
|
||||||
kit.Int(kit.Select("0", m.Option("cache.offend"))),
|
kit.Int(kit.Select("0", m.Option("cache.offend"))),
|
||||||
kit.Int(kit.Select("10", m.Option("cache.limit"))),
|
kit.Int(kit.Select("10", m.Option("cache.limit"))),
|
||||||
match, value, cb)
|
match, value, cb)
|
||||||
|
15
init.go
15
init.go
@ -3,7 +3,7 @@ package ice
|
|||||||
import (
|
import (
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
"github.com/shylinux/toolkits/conf"
|
"github.com/shylinux/toolkits/conf"
|
||||||
"github.com/shylinux/toolkits/log"
|
"github.com/shylinux/toolkits/logs"
|
||||||
"github.com/shylinux/toolkits/miss"
|
"github.com/shylinux/toolkits/miss"
|
||||||
"github.com/shylinux/toolkits/task"
|
"github.com/shylinux/toolkits/task"
|
||||||
|
|
||||||
@ -82,12 +82,6 @@ var Index = &Context{Name: "ice", Help: "冰山模块",
|
|||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
"miss": {Value: kit.Dict(
|
|
||||||
kit.MDB_STORE, "var/data",
|
|
||||||
kit.MDB_FSIZE, "200000",
|
|
||||||
kit.MDB_LIMIT, "110",
|
|
||||||
kit.MDB_LEAST, "100",
|
|
||||||
)},
|
|
||||||
"task": {Value: kit.Dict(
|
"task": {Value: kit.Dict(
|
||||||
kit.MDB_STORE, "var/data",
|
kit.MDB_STORE, "var/data",
|
||||||
kit.MDB_LIMIT, "110",
|
kit.MDB_LIMIT, "110",
|
||||||
@ -155,10 +149,9 @@ func Run(arg ...string) string {
|
|||||||
arg = append(arg, "web.space", "connect", "self")
|
arg = append(arg, "web.space", "connect", "self")
|
||||||
}
|
}
|
||||||
|
|
||||||
conf := conf.New(nil)
|
log.Init(conf.Sub("log"))
|
||||||
task.Init(conf, 10)
|
miss.Init(conf.Sub("miss"))
|
||||||
miss.Init(conf)
|
task.Init(conf.Sub("task"))
|
||||||
log.Init(conf)
|
|
||||||
|
|
||||||
frame := &Frame{}
|
frame := &Frame{}
|
||||||
Index.root = Index
|
Index.root = Index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user