Skip to content

feat: implement abstract cache service to allow support for flexible caching system, as well as support for multiple tokens - #3

Closed
ZejdCicak wants to merge 2 commits into
saleweaver:mainfrom
ZejdCicak:feat/add-support-for-multiple-tokens
Closed

ZejdCicak wants to merge 2 commits into
saleweaver:mainfrom
ZejdCicak:feat/add-support-for-multiple-tokens

Conversation

@ZejdCicak

Copy link
Copy Markdown

This pull request introduces a new caching mechanism by implementing an abstract base class for cache services and integrating it into the moloni/base/client.py module. The changes improve code modularity and flexibility by allowing different caching strategies to be used. Below are the key changes:

Addition of Cache Abstraction and Implementation

  • Added an abstract base class AbstractCacheService with methods get, set, and get_key to define a contract for cache services. (moloni/base/client.py, moloni/base/client.pyR16-R48)
  • Implemented a concrete CacheService class that extends AbstractCacheService and uses TTLCache for caching functionality. (moloni/base/client.py, moloni/base/client.pyR16-R48)

Integration of Cache Service in the Client

  • Modified the __init__ method of the client to accept an optional AbstractCacheService instance. If none is provided, a default CacheService is instantiated. (moloni/base/client.py, moloni/base/client.pyR64-R86)
  • Updated the get_auth method to leverage the new cache service for retrieving and storing tokens, replacing the previous direct use of TTLCache. (moloni/base/client.py, moloni/base/client.pyR64-R86)

…caching system, as well as support for multiple tokens
@ZejdCicak
ZejdCicak force-pushed the feat/add-support-for-multiple-tokens branch 2 times, most recently from e020842 to feaea4a Compare July 18, 2025 01:38
@ZejdCicak
ZejdCicak force-pushed the feat/add-support-for-multiple-tokens branch from feaea4a to acba110 Compare July 22, 2025 16:00
@ZejdCicak ZejdCicak closed this Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant