LoginSignup
0
0

More than 5 years have passed since last update.

メモ g a e

Last updated at Posted at 2017-10-09

ハンドラ

func handler(w http.ResponseWriter, r *http.Request) {
}

r.URL.Hostの値

xxxxxxxx.appspot.com

リクエストタイムアウト

ctxWithDeadline, _ := context.WithTimeout(ctx, 40*time.Second)
httpClient := urlfetch.Client(ctxWithDeadline)

キュー

設定ファイル

queue.yaml
queue:
- name: q-test
  rate: 1/s

キューの命名規則

'^(?:^[A-Za-z0-9-]{0,499}$)$'

memcache

[]byteでやり取り

item := &memcache.Item{
    Key:  "key",
    Value: []byte("value"),
}
memcache.Set(ctx, item)
item, err := memcache.Get(ctx, "key")
value = string(item.Value)

JSONでやりとり

保存

d := &Data{何かのデータ}
item := &memcache.Item{
    Key: "xxxx",
    Object: d,
}
err := memcache.JSON.Set(ctx, item)

取り出し

key := "xxxxx"
d := &Data{}
memcache.JSON.Get(ctx, key, d)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0