Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[#40] Provide cleaner contracts #41

Merged
merged 2 commits into from
Jan 21, 2024
Merged

Conversation

maypok86
Copy link
Owner

@maypok86 maypok86 commented Jan 21, 2024

Problem

Now otter uses an api very similar to other go cache libraries, but unfortunately it is not particularly beautiful and extensible.

For example, now we have Set(key, value) and SetWithTTL(key, value, ttl) functions, but if we want to add SetIfAbsent(key, value) function, we also need SetIfAbsentWithTTL(key, value, ttl) function, which doesn't look nice anymore.

Solution

Implement a more advanced version of the builder and a set of cache wrappers.

Related issue(s)

✅ Checklist for your Pull Request

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
  • Public contracts

    • My changes doesn't break project license.

Stylistic guide (mandatory)

  • My code complies with the styles guide.

  • My commit history is clean (only contains changes relating to my
    issue/pull request and no reverted-my-earlier-commit changes) and commit
    messages start with identifiers of related issues in square brackets.

    Example: [#42] Short commit description

    If necessary both of these can be achieved even after the commits have been
    made/pushed using rebase and squash.

Before merging (mandatory)

  • Check target branch of PR is set correctly

@maypok86 maypok86 merged commit 7bc76a9 into main Jan 21, 2024
6 checks passed
@maypok86 maypok86 deleted the maypok86/#40-cleaner-api-contracts branch January 21, 2024 18:39
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleaner api contracts
1 participant