示例#1
0
        public async Task <IList <IntentClassifier> > GetAllIntents(bool fromCache = false)
        {
            IList <IntentClassifier> intents = null;

            if (fromCache)
            {
                intents = await _redisCache.StringGetAsync <IList <IntentClassifier> >("aichat-intents");
            }

            if (intents == null)
            {
                intents = await _luisAuthoringClient.Model.ListIntentsAsync(_luisSettings.AppId, _luisSettings.LuisVersion);

                if (intents != null)
                {
                    await _redisCache.StringSetAsync("aichat-intents", intents);
                }
            }
            return(intents?.ToList());
        }
示例#2
0
 public async Task <ActionResult <string> > GetCacheValue(string key)
 {
     return(Ok(await _redisCacheService.StringGetAsync <string>(key)));
 }