updates
This commit is contained in:
parent
accda24c6d
commit
35c4455331
BIN
079-redis/079-redis
Executable file
BIN
079-redis/079-redis
Executable file
Binary file not shown.
@ -1,10 +1,10 @@
|
||||
// ## Redis
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fzzbt/radix/redis"
|
||||
"time"
|
||||
)
|
||||
import "github.com/fzzbt/radix/redis"
|
||||
import "time"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// initialize
|
||||
@ -63,15 +63,7 @@ func main() {
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
// == running
|
||||
// $ redis-server
|
||||
// $ cd xx-redis
|
||||
// $ go get
|
||||
// $ ./xx-redis
|
||||
|
||||
// == todo
|
||||
// connection pooling
|
||||
// concurrency
|
||||
// reconnection
|
||||
// errors
|
||||
// redis url
|
||||
// todo: connection pooling & concurrency?
|
||||
// todo: reconnection?
|
||||
// todo: errors?
|
||||
// todo: redis_url
|
6
079-redis/redis.sh
Normal file
6
079-redis/redis.sh
Normal file
@ -0,0 +1,6 @@
|
||||
# Start a Redis server.
|
||||
$ redis-server
|
||||
|
||||
# In another terminal, run the redis client:
|
||||
$ go get github.com/fzzbt/radix/redis
|
||||
$ go run redis.go
|
@ -1,6 +1,9 @@
|
||||
// Regexs
|
||||
|
||||
package main
|
||||
|
||||
import ("fmt"; "regexp")
|
||||
import "regexp"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
m1, _ := regexp.MatchString("p[a-z]+ch", "apple")
|
||||
@ -13,6 +16,5 @@ func main() {
|
||||
fmt.Println(r1.MatchString("peach"))
|
||||
}
|
||||
|
||||
// == todo
|
||||
// more
|
||||
// gsub with regexp
|
||||
// todo: more
|
||||
// todo: gsub with regexp
|
5
080-regexs/regexs.sh
Normal file
5
080-regexs/regexs.sh
Normal file
@ -0,0 +1,5 @@
|
||||
$ go run regexs.go
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
@ -1,6 +1,11 @@
|
||||
// ## Scatter-Gather
|
||||
|
||||
package main
|
||||
|
||||
import ("sync"; "time"; "math/rand"; "fmt")
|
||||
import "sync"
|
||||
import "time"
|
||||
import "math/rand"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
times := new([20]int)
|
||||
|
Loading…
x
Reference in New Issue
Block a user