Class GlobalCache
-
- All Implemented Interfaces:
public class GlobalCacheThe global cache.
-
-
Field Summary
Fields Modifier and Type Field Description private UrlPoolurlPoolprivate final FetchingCachefetchingCacheprivate final ConcurrentExpiringLRUCache<String, WebPage>pageCacheprivate final ConcurrentExpiringLRUCache<String, FeaturedDocument>documentCacheprivate final ImmutableConfigconf
-
Constructor Summary
Constructors Constructor Description GlobalCache(ImmutableConfig conf)
-
Method Summary
Modifier and Type Method Description UrlPoolgetUrlPool()A url pool contains many url caches, the urls added to the pool will be processed in crawl loops. UnitsetUrlPool(UrlPool urlPool)A url pool contains many url caches, the urls added to the pool will be processed in crawl loops. FetchingCachegetFetchingCache()Fetching cache holds the URLs being fetched. ConcurrentExpiringLRUCache<String, WebPage>getPageCache()The global page cache, a page will be removed automatically if it's expired or the cache is full. ConcurrentExpiringLRUCache<String, FeaturedDocument>getDocumentCache()The global document cache, a document will be removed automatically if it's expired or the cache is full. final ImmutableConfiggetConf()final UnitresetCaches()Reset all caches. final UnitclearCaches()Clear all caches. final UnitclearPDCaches()Clear page cache and document cache. final UnitputPDCache(WebPage page, FeaturedDocument document)Put the page and the document in the cache. final UnitremovePDCache(String url)Remove items specified by the url from page cache and document cache. -
-
Method Detail
-
getUrlPool
UrlPool getUrlPool()
A url pool contains many url caches, the urls added to the pool will be processed in crawl loops.
-
setUrlPool
Unit setUrlPool(UrlPool urlPool)
A url pool contains many url caches, the urls added to the pool will be processed in crawl loops.
-
getFetchingCache
FetchingCache getFetchingCache()
Fetching cache holds the URLs being fetched.
URLs are cached before being fetched and removed from the cache after retrieval.
The cache is used to avoid fetching the same URL multiple times.
-
getPageCache
ConcurrentExpiringLRUCache<String, WebPage> getPageCache()
The global page cache, a page will be removed automatically if it's expired or the cache is full.
-
getDocumentCache
ConcurrentExpiringLRUCache<String, FeaturedDocument> getDocumentCache()
The global document cache, a document will be removed automatically if it's expired or the cache is full.
-
getConf
final ImmutableConfig getConf()
-
resetCaches
final Unit resetCaches()
Reset all caches. After this operation, all caches will be empty.
-
clearCaches
final Unit clearCaches()
Clear all caches. After this operation, all caches will be empty.
-
clearPDCaches
final Unit clearPDCaches()
Clear page cache and document cache. After this operation, page cache and document cache will be empty.
-
putPDCache
final Unit putPDCache(WebPage page, FeaturedDocument document)
Put the page and the document in the cache.
-
removePDCache
final Unit removePDCache(String url)
Remove items specified by the url from page cache and document cache.
-
-
-
-