Beispiel #1
0
func RedisGet(r redis.AsyncClient, k string) (value []byte, timeout bool) {
	f, rerr := r.Get(k)
	if rerr != nil {
		log.Fatal("RedisGet failed: ", rerr)
	}

	value, rerr, timeout = f.TryGet(REDIS_GET_TIMEOUT)
	if rerr != nil {
		log.Fatal("RedisGet failed: ", rerr)
	}

	if timeout {
		loadtimeout++
		log.Println("load timeout! count: ", loadtimeout)
		return
	}
	return
}
Beispiel #2
0
func RedisSet(r redis.AsyncClient, k string, val []byte) (timeout bool) {
	f, rerr := r.Set(key, val)
	if rerr != nil {
		log.Fatal("RedisSet failed: ", rerr)
	}

	_, rerr, timeout = f.TryGet(REDIS_SET_TIMEOUT)
	if rerr != nil {
		log.Fatal("RedisSet failed: ", rerr)
	}

	if timeout {
		savetimeout++
		log.Println("save timeout! count: ", savetimeout)
		return
	}

	return
}