示例#1
0
 public Option <string> GetPage()
 {
     using (var client = _redisProvider.GetDatabase().GetReadOnlyClient())
     {
         var page = client.GetRandomItemFromSet("to_crawl");
         if (page == null)
         {
             _logger.LogInformation("No more pages to crawl. Returning None.");
             return(Option <string> .None);
         }
         return(page);
     }
 }
示例#2
0
        public void Save(PageCrawlResult page)
        {
            _logger.LogInformation($"Saving crawl result of page [{page.Url}] to the database.");
            var db         = _redisProvider.GetDatabase();
            var serialized = JsonConvert.SerializeObject(page);

            db.StringSet(page.Url, serialized);
        }