Sorted sets
Sorted sets are like sets, but their elements have a score (weight), so they are all ordered.
Example
<?php // Initialize Rediska $rediska = new Rediska(); // Initialize sorted set $sortedSet = new Rediska_Key_SortedSet('sortedSet'); // Add element with score 1 $sortedSet[1] = 'first element'; // Add element with score 2 $sortedSet[2] = 'second element'; // Get elements count echo count($sortedSet); #=> 2 // Check if element with score 1 is present echo isset($sortedSet[1]); #=> true // Get element with score 1 echo $sortedSet[1]; #=> first element // Remove element with score 2 unset($sortedSet[2]); // Iterate sorted set foreach($sortedSet as $element) { echo $element; } // Iterate sorted set with scores foreach($sortedSet->toArray(true) as $element) { echo "{$element->score} => {$element->value}"; } ?>