Ejemplo n.º 1
0
        public ActionResult GetSpeechToken()
        {
            var key       = "Ole-SpeechToken";
            var isInCache = HttpRuntime.Cache[key] != null;
            var token     = isInCache
                ? HttpRuntime.Cache[key]
                : SpeechService.GetSpeechToken();

            if (!isInCache)
            {
                HttpRuntime.Cache.Add(key, token, null, DateTime.UtcNow.AddMinutes(10), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
            }

            return(Json(new { Token = token, Region = ChatSettings.SpeechRegion, Language = SpeechLocaleOptions.enUS.MemberAttrValue() }));
        }