hyperledger-firefly / hyperledger-firefly/firefly

Centralized cache manager

Open
#943 1 comment 0 reactions 1 assignee Claimed by @Chengxuan View on GitHub
enhancement
Dominant language
Go
Stars
602
Forks
246
Avg merge
18h 47m
Merged PRs (30d)
6

Description

FireFly has lots of isolated usage of `ccache` in many different managers. See [here](https://github.com/hyperledger/firefly/blob/bd63308c8cc855b4859ffc114d4ef6fcdcd7f42e/internal/identity/identitymanager.go#L66) and [here](https://github.com/hyperledger/firefly/blob/bd63308c8cc855b4859ffc114d4ef6fcdcd7f42e/internal/blockchain/ethereum/ethereum.go#L68) 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)` and `Set(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](https://github.com/hyperledger/firefly/blob/bd63308c8cc855b4859ffc114d4ef6fcdcd7f42e/internal/coreconfig/coreconfig.go#L124), 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 under `cache`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.