cache_tab caching errors

Open
#4 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
erlang
Domain
backend

Research direction

Start by reproducing the reported behavior through cache_tab:lookup/3, using the two callbacks shown in the issue. Inspect how the lookup handles an error result and verify that the subsequent successful lookup returns 1 instead of the cached error.

Written by the indexing model from the issue text.

Description

documentation

When I cache something which returns "error", the value is cached.

For example:

> cache_tab:new(cache_test, []).
> cache_tab:lookup(cache_test, key1, fun() -> error end).
> error
> cache_tab:lookup(cache_test, key1, fun() -> {ok, 1} end).
> error

I was expecting to get 1 as a value instead of error. It seems that cache_tab is caching the error as well. Maybe the documentation is wrong and I need to return something else.

Thanks!

PS: I'm using version 1.0.4 of cache_tab

Dominant language
Erlang
Stars
47
Forks
23
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from processone/cache_tab

All issues in processone/cache_tab

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.