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 package main
import ( import "github.com/fzzbt/radix/redis"
"fmt" import "time"
"github.com/fzzbt/radix/redis" import "fmt"
"time"
)
func main() { func main() {
// initialize // initialize
@ -63,15 +63,7 @@ func main() {
time.Sleep(time.Second) time.Sleep(time.Second)
} }
// == running // todo: connection pooling & concurrency?
// $ redis-server // todo: reconnection?
// $ cd xx-redis // todo: errors?
// $ go get // todo: redis_url
// $ ./xx-redis
// == todo
// connection pooling
// concurrency
// reconnection
// errors
// 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 package main
import ("fmt"; "regexp") import "regexp"
import "fmt"
func main() { func main() {
m1, _ := regexp.MatchString("p[a-z]+ch", "apple") m1, _ := regexp.MatchString("p[a-z]+ch", "apple")
@ -13,6 +16,5 @@ func main() {
fmt.Println(r1.MatchString("peach")) fmt.Println(r1.MatchString("peach"))
} }
// == todo // todo: more
// more // todo: gsub with regexp
// 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 package main
import ("sync"; "time"; "math/rand"; "fmt") import "sync"
import "time"
import "math/rand"
import "fmt"
func main() { func main() {
times := new([20]int) times := new([20]int)