예제 #1
0
        public async Task <List <CollocationsMetaData> > GetCollocationsByParagraph_Async(Guid corpusId, string word, int direction)
        {
            var collocationsByParagraph = _cacheRepository.GetCollocationsByParagraph(corpusId, word, direction);

            if (collocationsByParagraph != null)
            {
                return(await collocationsByParagraph);
            }

            var xd = await _searchCorpusService.GetCollocationsByParagraphAsync(corpusId, word, direction);

            _cacheRepository.InsertIntoCache <CollocationsInfo>(corpusId, word, xd);
            return(await Task.FromResult(xd != null?xd.CollocationsByParagraph : null));
        }