I am writing some library code in Go, where different modules/packages need to cache their credentials like public keys and authentication tokens. I have two ideas:
- Each package will take care of it's own caching.
- A central cache wrapped over by different implementations of respective packages.
- There will be an actual cache object holding the key-pairs.
- Respective implementations for packages will perform operations like get, set and refresh over the cache.
- Packages will use this implementations.
I am trying to understand pros/cons of both the approaches.
Aucun commentaire:
Enregistrer un commentaire