hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

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

Open Chethan-rao opened this issue 8 months ago • 0 comments

Type of Change

  • [ ] Bugfix
  • [ ] New feature
  • [ ] Enhancement
  • [x] 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

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

Chethan-rao avatar Jun 22 '24 16:06 Chethan-rao