feat: add wildcard job

This commit is contained in:
崔竞宁
2023-05-07 16:19:11 +08:00
parent 6351045e0f
commit 8502bf37dc
13 changed files with 287 additions and 161 deletions

15
cache.go Normal file
View File

@@ -0,0 +1,15 @@
package acp
func Cache[i comparable, o any](f func(in i) o) func(in i) o {
cache := make(map[i]o, 0)
return func(in i) o {
cached, has := cache[in]
if has {
return cached
}
out := f(in)
cache[in] = out
return out
}
}