Skip to content

cache(chain): return an error from Get when no caches are configured#309

Open
c-tonneslan wants to merge 1 commit into
eko:masterfrom
c-tonneslan:fix/chain-empty-caches
Open

cache(chain): return an error from Get when no caches are configured#309
c-tonneslan wants to merge 1 commit into
eko:masterfrom
c-tonneslan:fix/chain-empty-caches

Conversation

@c-tonneslan

Copy link
Copy Markdown

If a ChainCache is built with no underlying caches, `Get` returned the zero value of T with a nil error, which looks like a cache hit on a default-constructed value. `ChainCache[[]byte].Get` returned a zero-length `[]byte` and no error, so callers had no way to tell that nothing was actually cached.

Guard the empty-caches case so callers see a real error.

Closes #281.

If a ChainCache is built with no underlying caches, Get returned the
zero value of T with a nil error, which looks indistinguishable from a
cache hit on a default-constructed value. ChainCache[[]byte].Get returned
a zero-length []byte and no error.

Guard the empty-caches case so callers see a real error.

Closes eko#281

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
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.

ChainCache returns default value with no caches configured

1 participant