(persistCache)
| 4 | const cache = new RedisCache({ host: '127.0.0.1', port: 6379 }); |
| 5 | |
| 6 | function launch(persistCache) { |
| 7 | return HCCrawler.launch({ |
| 8 | onSuccess: result => { |
| 9 | console.log(`Requested ${result.options.url}.`); |
| 10 | }, |
| 11 | cache, |
| 12 | persistCache, // Cache won't be cleared when closing the crawler if set true |
| 13 | }); |
| 14 | } |
| 15 | |
| 16 | (async () => { |
| 17 | const crawler1 = await launch(true); // Launch the crawler with persisting cache |