// handler for getting an specific app's details from cache
//
// id is target app's id to seek details for, bot is BotAPI, update is arrived telegram update
// returns true on success, false on failure
handler for getting an specific app's details from cache

id is target app's id to seek details for, bot is BotAPI, update is arrived telegram update
returns true on success, false on failure
// handler for getting an specific app ' s details from cache // // id is target app ' s id to seek details for bot is BotAPI update is arrived telegram update // returns true on success false on failure
func handleSpecificIdByCache(id string, bot *tgbotapi.BotAPI, update tgbotapi.Update) bool {
	val, err := redisClient.Get("app_info:" + id).Result()
	if err == nil {
		appInfo := searchApi.AppleSearchAppInfo{}
		err2 := json.Unmarshal([]byte(val), &appInfo)
		if err2 == nil {
			msg := tgbotapi.NewMessage(update.Message.Chat.ID, getHtmlOfAppInfo(appInfo))
			msg.ParseMode = "HTML"
			msg.ReplyMarkup = tgbotapi.NewRemoveKeyboard(true)
			bot.Send(msg)
			err3 := redisClient.Expire("app_info:"+id, time.Duration(REDIS_CACHE_EXPIRE_SECS)*time.Second).Err()
			if err3 != nil {
				log.Println("Error in extending cache key expiration, err: " + err3.Error())
			}
			return true
		}
		log.Println("Parsing Redis response as json failed with error: " + err2.Error())
	} else if err != redis.Nil {
		log.Println("Getting Redis row failed with error: " + err.Error())
	}
	return false
}
func handleSpecificIdByCache ( id string , bot * tgbotapi . BotAPI , update tgbotapi . Update ) bool { val , err := redisClient . Get ( " " + id ) . Result ( ) if err == nil { appInfo := searchApi . AppleSearchAppInfo { } err2 := json . Unmarshal ( [ ] byte ( val ) , & appInfo ) if err2 == nil { msg := tgbotapi . NewMessage ( update . Message . Chat . ID , getHtmlOfAppInfo ( appInfo ) ) msg . ParseMode = " " msg . ReplyMarkup = tgbotapi . NewRemoveKeyboard ( true ) bot . Send ( msg ) err3 := redisClient . Expire ( " " + id , time . Duration ( REDIS_CACHE_EXPIRE_SECS ) * time . Second ) . Err ( ) if err3 != nil { log . Println ( " " + err3 . Error ( ) ) } return true } log . Println ( " " + err2 . Error ( ) ) } else if err != redis . Nil { log . Println ( " " + err . Error ( ) ) } return false }
handler for getting an specific app's details from cache
handler for getting an specific app ' s details from cache