in reply to Re: Ordering objects using external index
in thread Ordering objects using external index
Thanks for a comprehensive reply! I'll certainly incorporate some ideas as soon as I'm at work!
Your main suggestion is to keep the hash always up-to-date as I do something on the messages array. That is actually my next big problem :)) You see, the messages can be sorted by different criteria. Currently, there're only eight. So, on each write operation on the messages array I will need to update eight indices. That looks weird.
The main reason to separate sorting order into another array was to be able to save lots of presorted indices (currently they are in memcached) for a big message list and then quickly retrieve messages in the order I need. So the actual events that take place in the script are these: load big array, load indices, try to sort the array in less than n*log(n) ops using the indices. Hope this will clarify my intentions. I can probably try to save both $uids and %uid2msg for each criterium.
Are there any other way to presort array on different criteria and save the order for future reference? Seems like this is my real question :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Ordering objects using external index
by fergal (Chaplain) on Sep 07, 2004 at 15:30 UTC |