-
Notifications
You must be signed in to change notification settings - Fork 116
Add cache to /endpoints/publisher/listing #5462
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||
| # Local Redis for Development | ||||
|
|
||||
| This setup provides a local Redis instance for development and testing purposes. | ||||
|
|
||||
| ## Getting Started | ||||
|
|
||||
| 1. Ensure Docker is installed. | ||||
| 2. ```cd cache``` and run ```docker compose run redis-cli``` | ||||
|
|
||||
| 3. Then you can interact with the redis server. | ||||
| To check all saved keys use: | ||||
| ``` | ||||
| KEYS * | ||||
| ``` | ||||
| 4. To exit the interactive promt, run | ||||
| ``` | ||||
| exit | ||||
| ``` | ||||
| 5. To stop the container, run: | ||||
| ``` | ||||
| docker compose down | ||||
| ``` | ||||
|
||||
| ``` |
Configuration
The cache utility connects to Redis using the following environment variables:
REDIS_HOST(default: localhost)REDIS_PORT(default: 6379)
Make sure Redis is running before starting the application.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from canonicalwebteam.stores_web_redis.utility import RedisCache | ||
|
codeEmpress1 marked this conversation as resolved.
|
||
| from webapp.config import APP_NAME | ||
|
|
||
| redis_cache = RedisCache( | ||
| namespace=APP_NAME, | ||
| maxsize=1000, | ||
| ttl=300, | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| services: | ||
| redis: | ||
| image: redis:7 | ||
| ports: | ||
| - "6379:6379" | ||
| volumes: | ||
| - redis-data:/data | ||
| command: ["redis-server", "--appendonly", "yes"] | ||
| healthcheck: | ||
| test: ["CMD", "redis-cli", "-h", "localhost", "-p", "6379", "ping"] | ||
| interval: 5s | ||
| timeout: 2s | ||
| retries: 5 | ||
|
|
||
| redis-cli: | ||
| image: redis:7 | ||
| entrypoint: ["redis-cli", "-h", "redis", "-p", "6379"] | ||
| depends_on: | ||
| redis: | ||
| condition: service_healthy | ||
|
|
||
| volumes: | ||
| redis-data: |
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.
every time we run snapcraft locally do we need to do this? or is it just for testing redis?
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.
This is for testing redis locally only.