Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Enhancement: add new method GetWithTTL to return value together with TTL #102

Open
kcmvp opened this issue Mar 30, 2023 · 0 comments
Open

Comments

@kcmvp
Copy link

kcmvp commented Mar 30, 2023

First, thank you very much for the great project!

I am building a disstributed KV(https://github.com/kcmvp/daos) based on buntdb, for data rebalancing when new nodes join , the TTL of an entry need to be syncd as well. right now I am using two api call (Get & TTL) to get value and entry's ttl, it work well, but I found that it will use more time to get entries especially when there are lots of entrie need to be synced.

I would like to raise a PR by adding a new mthod GetWithTTL

func (tx *Tx) GetWithTTL(key string) (string, time.Duration, error)

1: this method will return value for a key together with it's TTL.
2: If the item does not exist or if the item has expired then ErrNotFound is returned.
3: A negative duration will be returned for items that do not have an expiration.

Thank you!

@kcmvp kcmvp changed the title Feature Request: Get value with ttl Enhancement: Get value with ttl Mar 31, 2023
@kcmvp kcmvp changed the title Enhancement: Get value with ttl Enhancement: add new method GetWithTTL to return value together with TTL May 17, 2023
kcmvp added a commit to kcmvp/buntdb that referenced this issue May 17, 2023
kcmvp added a commit to kcmvp/buntdb that referenced this issue May 18, 2023
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

No branches or pull requests

1 participant