-
-
Save AnderRV/797bfb64cbdd5e4e2d996dc184c121c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from redis import Redis | |
connection = Redis(db=1) | |
to_visit_key = 'crawling:to_visit' | |
visited_key = 'crawling:visited' | |
queued_key = 'crawling:queued' | |
def pop_to_visit_blocking(timeout=0): | |
return connection.blpop(to_visit_key, timeout) | |
def count_visited(): | |
return connection.scard(visited_key) | |
def is_queued(value): | |
return connection.sismember(queued_key, value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment