Documentation ¶
Index ¶
- type RedisClient
- type Storage
- func (s *Storage) AddRequest(r []byte) error
- func (s *Storage) Clear() error
- func (s *Storage) Cookies(u *url.URL) string
- func (s *Storage) GetRequest() ([]byte, error)
- func (s *Storage) Init() error
- func (s *Storage) IsVisited(requestID uint64) (bool, error)
- func (s *Storage) QueueSize() (int, error)
- func (s *Storage) SetCookies(u *url.URL, cookies string)
- func (s *Storage) Visited(requestID uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient interface { Ping(ctx context.Context) *redis.StatusCmd Keys(ctx context.Context, pattern string) *redis.StringSliceCmd Get(ctx context.Context, key string) *redis.StringCmd Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd Del(ctx context.Context, keys ...string) *redis.IntCmd Exists(ctx context.Context, keys ...string) *redis.IntCmd Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd RPop(ctx context.Context, key string) *redis.StringCmd LLen(ctx context.Context, key string) *redis.IntCmd }
RedisClient is because go-redis has many kind of clients.
type Storage ¶
type Storage struct { // Client any kind of [go-redis](https://github.com/go-redis/redis) client Client RedisClient // Prefix is an optional string in the keys. It can be used // to use one redis database for independent scraping tasks. Prefix string // Expiration time for Visited keys. After expiration pages // are to be visited again. Expires time.Duration // Context can be used for canceling all redis request, if you supply your own. Context context.Context // contains filtered or unexported fields }
Storage implements the redis storage backend for Colly
func (*Storage) AddRequest ¶
AddRequest implements queue.Storage.AddRequest() function
func (*Storage) GetRequest ¶
GetRequest implements queue.Storage.GetRequest() function
func (*Storage) SetCookies ¶
SetCookies implements colly/storage..SetCookies()
Click to show internal directories.
Click to hide internal directories.