备注 g a e

处理程序

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

r.URL.Host的值

xxxxxxxx.appspot.com
请将以下内容进行中文本地化转述,仅需要一种选择:

xxxxxxxx.appspot.com

请求超时

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

排队

配置文件

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

队列命名规则

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

内存缓存

用[]字节进行交流

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)
广告
将在 10 秒后关闭
bannerAds