This commit is contained in:
Mark McGranaghan 2012-09-23 11:54:18 -07:00
parent accda24c6d
commit 35c4455331
6 changed files with 32 additions and 22 deletions

BIN
079-redis/079-redis Executable file

Binary file not shown.

View File

@ -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
View 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

View File

@ -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
View File

@ -0,0 +1,5 @@
$ go run regexs.go
false
true
false
true

View File

@ -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)