hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

refactor(cache): remove `deref` impl on `Cache` type

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

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

Chethan-rao avatar May 17 '24 10:05 Chethan-rao