momentohq / client-sdk-javascript

Official JavaScript SDK for Momento Serverless Cache
Apache License 2.0
55 stars 20 forks source link

feat: adds order opt to sortedset getRank #1409

Closed eaddingtonwhite closed 1 month ago

eaddingtonwhite commented 1 month ago

Currently for sortedSetGetRank we only support fetching in Ascending order.

await momento.sortedSetGetRank('my-cache', 'my-sorted-set', 'my-element');

This PR adds optional call options to sortedSetGetRank to sort the sorted set by Descending or Ascending order when determining the rank of the passed element. So can call like this now:

await momento.sortedSetGetRank('my-cache', 'my-sorted-set', 'my-element', {
    order: SortedSetOrder.Descending
});