Open awrichar opened 2 years ago
Two items with TODOs that aren't yet cached: https://github.com/hyperledger/firefly/blob/bd63308c8cc855b4859ffc114d4ef6fcdcd7f42e/internal/events/tokens_transferred.go#L72 https://github.com/hyperledger/firefly/blob/bd63308c8cc855b4859ffc114d4ef6fcdcd7f42e/internal/events/tokens_approved.go#L72
Might as well add token pools to the cache after centralizing it.
FireFly has lots of isolated usage of
ccache
in many different managers. See here and here for examples.It would make sense to consolidate this under a new, centralized Cache Manager component. It should be created under
internal/cache
and should follow the pattern set by other managers, particularly the Metrics Manager. It should be a singleton like Metrics Manager, and should be initialized early by Namespace Manager (the root manager). It can then be passed to all other plugins and managers that require it.The interface can be quite simple, likely something like
Get(category string, key string)
andSet(category string, key string)
.As part of this, it would also make sense to consolidate the config options under a top-level
cache
key. The blockchain cache is already following this pattern, but other cache configuration is scattered at various levels throughout the config tree. The old keys should be deprecated in favor of new ones that are grouped together undercache
.