PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/www/redis/Rediska/Command/UnionSortedSets.php

http://github.com/isaacsu/twich
PHP | 34 lines | 14 code | 3 blank | 17 comment | 0 complexity | af30e2778be0b0c5f055367b24e1788d MD5 | raw file
Possible License(s): GPL-2.0, JSON
  1. <?php
  2. /**
  3. * @see Rediska_Command_CompareSets
  4. */
  5. require_once 'Rediska/Command/CompareSortedSets.php';
  6. /**
  7. * Store to key union between the sorted sets
  8. *
  9. * @param array $names Array of key names or associative array with weights
  10. * @param string $storeName Result sorted set key name
  11. * @param string $aggregation Aggregation method: SUM (for default), MIN, MAX.
  12. * @return integer
  13. *
  14. * @author Ivan Shumkov
  15. * @package Rediska
  16. * @version 0.4.2
  17. * @link http://rediska.geometria-lab.net
  18. * @licence http://www.opensource.org/licenses/bsd-license.php
  19. */
  20. class Rediska_Command_UnionSortedSets extends Rediska_Command_CompareSortedSets
  21. {
  22. protected $_command = 'ZUNION';
  23. protected function _compareSets($sets)
  24. {
  25. $resultSet = array();
  26. foreach($sets as $name => $values) {
  27. $resultSet = array_merge($resultSet, $values);
  28. }
  29. return array_unique($resultSet);
  30. }
  31. }