Comments (6)
we have to accomplish this with saving either the time or the highscore with some math function to reverse it's meaning and then use the module.
I think this is just the right way.
from tairzset.
That is one solution for sure; But why not add something to handle it inside the module? One way I can think of is we can add an option to express the sorting direction when creating a sortedset. For example I say the sort direction is 1#-1#1
which means for a score like score1#score2#score3
, score1 and score3 are ordered in the same way and score2 is sorted in the opposite way (and change the way the are compared together based on that option). This is just a thought though
from tairzset.
cc @chenyang8094 @yangbodong22011
from tairzset.
we have to accomplish this with saving either the time or the highscore with some math function to reverse it's meaning and then use the module.
I think this is just the right way.
I think so too, and I don't think the syntax modification or increased memory footprint (need to store a collation) due to this requirement is worth doing at the moment.
Let's keep the issue open and wait for more feedback.
from tairzset.
@H-Shafiei Thanks for your issue. Simple look, the command you need might be (with a sort option, only valid when tairzset is first created):
EXZADD key [NX|XX] [CH] [INCR] [SORT pattern] score member [score member ...]
where the pattern maybe 1#-1#1
or i#d#i
etc.
This is indeed more flexible (to adapt to the sorting needs of different scenarios).
In addition to the syntax modification, we may also need to record this pattern in each TairZsetObj
, so that we can keep this collation in subsequent writes. This will introduce a little memory overhead, but I don't think it will be huge (since it's key level, not every score).
But I still think this is a larger feature (functionally speaking). I also think we need more feedback, or you can try to submit a PR with your ideas, maybe that way we can discuss this better.
from tairzset.
@chenyang8094 Yes that's exactly what I was thinking of and I think it won't have a considerable overhead.
I was reading the code in order to see if I can work on it but I haven't coded in C for a few years; although I can read the code but I am almost sure that I can't change it without hundreds of bugs rising up :)
from tairzset.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tairzset.