File tree Expand file tree Collapse file tree 7 files changed +60
-0
lines changed Expand file tree Collapse file tree 7 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ services:
77 - ' 6379:6379'
88 command : redis-server --loglevel debug
99
10+ memcached :
11+ image : memcached:1.6.20-alpine
12+ ports :
13+ - ' 11211:11211'
14+
1015 mysql :
1116 image : mysql:8.0.33
1217 cap_add :
Original file line number Diff line number Diff line change 33use (
44 .
55 ./grpc
6+ ./memcache
67 ./mysql
78 ./postgres
89 ./redis
Original file line number Diff line number Diff line change 1+ module github.com/stealthrocket/net/memcache
2+
3+ go 1.20
4+
5+ require (
6+ github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746
7+ github.com/stealthrocket/net v0.1.2
8+ )
9+
10+ replace github.com/bradfitz/gomemcache => github.com/mar4uk/gomemcache v0.0.0-20221107102512-3adaeb8afff3
Original file line number Diff line number Diff line change 1+ github.com/mar4uk/gomemcache v0.0.0-20221107102512-3adaeb8afff3 h1:fODuxBhkSmNhMOD8faRXsUvoYG5rAijY4YYoOEdsXeY =
2+ github.com/mar4uk/gomemcache v0.0.0-20221107102512-3adaeb8afff3 /go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA =
3+ github.com/stealthrocket/net v0.1.2 h1:fxglKhsGrBKMQHiEZuiP2jKyg2WaledYi/G7ijaoAOQ =
4+ github.com/stealthrocket/net v0.1.2 /go.mod h1:9a0HqAOSQobNQt/QNqbIFMZzxOOwOrXU+XxXyeiu98o =
5+ golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M =
Original file line number Diff line number Diff line change 1+ // Package memcache provides an example of a memcache client compiled to
2+ // GOOS=wasip1.
3+ //
4+ // The test uses https://pkg.go.dev/github.com/bradfitz/gomemcache/memcache and
5+ // interacts with a memcache server on localhost:11211. The docker-compose.yml
6+ // file in the parent directory may be used to start a memcache server to run
7+ // the test against.
8+ //
9+ // Note that at this time, the dependency is changed to https://github.com/mar4uk/gomemcache
10+ // in order to get the changes from https://github.com/bradfitz/gomemcache/pull/158,
11+ // which is required to customize the dial function.
12+ //
13+ // When compiling to other targets than GOOS=wasip1, importing this package has
14+ // no effect.
15+ package memcache
Original file line number Diff line number Diff line change 1+ //go:build wasip1
2+
3+ package memcache
Original file line number Diff line number Diff line change 1+ //go:build wasip1
2+
3+ package memcache_test
4+
5+ import (
6+ "testing"
7+
8+ "github.com/bradfitz/gomemcache/memcache"
9+ "github.com/stealthrocket/net/wasip1"
10+ )
11+
12+ func TestMemcache (t * testing.T ) {
13+ client := memcache .New ("localhost:11211" )
14+ // Change the dial function so the client uses the WASI socket extensions
15+ // missing from Go 1.21.
16+ client .DialContext = wasip1 .DialContext
17+
18+ if err := client .Ping (); err != nil {
19+ t .Fatal (err )
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments