Exemplo n.º 1
0
        public byte[] GetRequest(byte[] data)
        {
            SearchQuery         query         = _repo.GetQuery(Encoding.UTF8.GetString(data));
            List <SearchResult> cachedResults = null;

            if (query != null && (DateTime.Now - query.Created).TotalSeconds < TTL)
            {
                // If its a previous non-stale query then use the
                // results stored in the cache
                cachedResults = _repo.
                                ListResultsBySearchQuery(query.Id);
            }

            return(Encoding.UTF8.GetBytes(
                       JsonConvert.SerializeObject(cachedResults)));
        }