Skip to content
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

refactor(cache): allow publish method of redis to accept list of keys #5085

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Chethan-rao
Copy link
Contributor

@Chethan-rao Chethan-rao commented Jun 22, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR includes following refactors -

  • Currently, publish method of redis takes in only one key to publish to a channel. Instead it should take in a list of keys to be published so that we can call publish once for all keys instead of calling once for every key.
  • Add a new method on redis interface to delete multiple keys
  • Created three separate methods: one for handling database calls with Redis redaction and publishing to IMC invalidation channel, another for Redis redaction and publishing, and the last one solely for publishing. This hierarchy provides flexibility for clients to perform either comprehensive invalidation or targeted actions.
  • In the redis subscriber logic, match on the channel name and perform the appropriate action

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@Chethan-rao Chethan-rao added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed C-refactor Category: Refactor labels Jun 22, 2024
@Chethan-rao Chethan-rao added this to the June 2024 Release milestone Jun 22, 2024
@Chethan-rao Chethan-rao self-assigned this Jun 22, 2024
@Chethan-rao Chethan-rao requested review from a team as code owners June 22, 2024 16:46
@Chethan-rao Chethan-rao linked an issue Jun 22, 2024 that may be closed by this pull request
crates/redis_interface/src/types.rs Outdated Show resolved Hide resolved
crates/drainer/src/stream.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/cache.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/cache.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/cache.rs Outdated Show resolved Hide resolved
crates/router/src/db/configs.rs Outdated Show resolved Hide resolved
crates/router/src/db/configs.rs Outdated Show resolved Hide resolved
crates/router/src/core/cache.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/pub_sub.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/pub_sub.rs Outdated Show resolved Hide resolved
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, looks good to me!

crates/hyperswitch_domain_models/src/errors.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/errors.rs Outdated Show resolved Hide resolved
crates/storage_impl/src/redis/cache.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Refactor S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] allow publish method of redis to accept list of keys
3 participants