-
Notifications
You must be signed in to change notification settings - Fork 508
feat: Add RedisStorageClient based on Redis v8.0+
#1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mantisus
wants to merge
23
commits into
apify:master
Choose a base branch
from
Mantisus:redis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,955
−8
Open
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
49d8db1
core implementation
Mantisus fe3eee1
add fakeredis
Mantisus 97ca5ea
Merge branch 'master' into redis
Mantisus 997fca3
add support for NDU storages
Mantisus 3c1aeed
clean code
Mantisus 75d81d8
up docs
Mantisus 31a1fa9
update guide
Mantisus d46ffbe
add in built-id
Mantisus 5b77ab6
add tests for Redis clients
Mantisus ccf713c
resolve
Mantisus 7c84ed1
suppress warnings
Mantisus a1f4403
resolve
Mantisus 122c923
add default dedup strategy
Mantisus 32cfe63
resolve
Mantisus ec34386
up tests
Mantisus c1dda54
up docs
Mantisus ad1d055
resolve
Mantisus c5d0941
save request state with reclaim
Mantisus a4a8a5b
Update src/crawlee/storage_clients/_redis/_storage_client.py
Mantisus f75d110
up first part
Mantisus 3b4f18d
up second part
Mantisus f93215a
resolve
Mantisus 5067613
up redis to 7.0.0
Mantisus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
docs/guides/code_examples/storage_clients/redis_storage_client_basic_example.py
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| from crawlee.crawlers import ParselCrawler | ||
| from crawlee.storage_clients import RedisStorageClient | ||
|
|
||
| # Create a new instance of storage client using connection string. | ||
| # 'redis://localhost:6379' is the just placeholder, replace it with your actual | ||
| # connection string. | ||
| storage_client = RedisStorageClient(connection_string='redis://localhost:6379') | ||
|
|
||
| # And pass it to the crawler. | ||
| crawler = ParselCrawler(storage_client=storage_client) |
27 changes: 27 additions & 0 deletions
27
docs/guides/code_examples/storage_clients/redis_storage_client_configuration_example.py
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from redis.asyncio import Redis | ||
|
|
||
| from crawlee.configuration import Configuration | ||
| from crawlee.crawlers import ParselCrawler | ||
| from crawlee.storage_clients import RedisStorageClient | ||
|
|
||
| # Create a new instance of storage client using a Redis client with custom settings. | ||
| # Replace host and port with your actual Redis server configuration. | ||
| # Other Redis client settings can be adjusted as needed. | ||
| storage_client = RedisStorageClient( | ||
| redis=Redis( | ||
| host='localhost', | ||
| port=6379, | ||
| retry_on_timeout=True, | ||
| socket_keepalive=True, | ||
| socket_connect_timeout=10, | ||
| ) | ||
| ) | ||
|
|
||
| # Create a configuration with custom settings. | ||
| configuration = Configuration(purge_on_start=False) | ||
|
|
||
| # And pass them to the crawler. | ||
| crawler = ParselCrawler( | ||
| storage_client=storage_client, | ||
| configuration=configuration, | ||
| ) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from ._dataset_client import RedisDatasetClient | ||
| from ._key_value_store_client import RedisKeyValueStoreClient | ||
| from ._request_queue_client import RedisRequestQueueClient | ||
| from ._storage_client import RedisStorageClient | ||
|
|
||
| __all__ = ['RedisDatasetClient', 'RedisKeyValueStoreClient', 'RedisRequestQueueClient', 'RedisStorageClient'] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should mention that Redis persistence is unlike that of filesystem or SQL storage and link to https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/