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
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.
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!