hyperswitch
hyperswitch copied to clipboard
refactor(cache): remove `deref` impl on `Cache` type
Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Currently Cache
is a type having inner value as MokaCache
.
pub struct Cache {
inner: MokaCache<String, Arc<dyn Cacheable>>,
}
There's a deref impl on this type which returns the inner MokaCache
. We should instead have custom methods on Cache
which calls the MokaCache
methods instead of deref doing the job. There's already custom methods available on Cache
. This PR refactors it to invoke these methods instead of calling it on the deref of Cache
.
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?
Basic sanity tests should suffice
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