|
6 | 6 | */
|
7 | 7 | class Redis
|
8 | 8 | {
|
| 9 | + const AFTER = ''; |
| 10 | + const BEFORE = ''; |
9 | 11 | /**
|
10 | 12 | * Creates a Redis client
|
11 | 13 | *
|
@@ -161,7 +163,7 @@ public function delete($key1, $key2 = NULL, $key3 = NULL) {}
|
161 | 163 | * Enter and exit transactional mode.
|
162 | 164 | *
|
163 | 165 | * @param Redis::MULTI | Redis::PIPELINE Defaults to Redis::MULTI. A Redis::MULTI block of commands runs as a single transaction; a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity. discard cancels a transaction.
|
164 |
| - * @return multi() returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until exec() is called. |
| 166 | + * @return Redis returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until exec() is called. |
165 | 167 | * @example
|
166 | 168 | * $ret = $redis->multi()
|
167 | 169 | * ->set('key1', 'val1')
|
@@ -1570,5 +1572,196 @@ public function zRangeByScore($key, $start, $end, array $options) {}
|
1570 | 1572 | */
|
1571 | 1573 | public function zRevRangeByScore($key, $start, $end, array $options) {}
|
1572 | 1574 |
|
| 1575 | + /** |
| 1576 | + * Returns the number of elements of the sorted set stored at the specified key which have |
| 1577 | + * scores in the range [start,end]. Adding a parenthesis before start or end excludes it |
| 1578 | + * from the range. +inf and -inf are also valid limits. |
| 1579 | + * @param string $key |
| 1580 | + * @param string $start |
| 1581 | + * @param string $end |
| 1582 | + * @return LONG the size of a corresponding zRangeByScore. |
| 1583 | + * @example |
| 1584 | + * $redis->zAdd('key', 0, 'val0'); |
| 1585 | + * $redis->zAdd('key', 2, 'val2'); |
| 1586 | + * $redis->zAdd('key', 10, 'val10'); |
| 1587 | + * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2') |
| 1588 | + */ |
| 1589 | + public function zCount($key, $start, $end) {} |
| 1590 | + |
| 1591 | + /** |
| 1592 | + * Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end]. |
| 1593 | + * @param string $key |
| 1594 | + * @param double|string $start double or "+inf" or "-inf" string |
| 1595 | + * @param double|string $end double or "+inf" or "-inf" string |
| 1596 | + * @returnLONG The number of values deleted from the sorted set |
| 1597 | + * @example |
| 1598 | + * $redis->zAdd('key', 0, 'val0'); |
| 1599 | + * $redis->zAdd('key', 2, 'val2'); |
| 1600 | + * $redis->zAdd('key', 10, 'val10'); |
| 1601 | + * $redis->zRemRangeByScore('key', 0, 3); // 2 |
| 1602 | + */ |
| 1603 | + public function zRemRangeByScore($key, $start, $end) {} |
| 1604 | + |
| 1605 | + /** |
| 1606 | + * @see zRemRangeByScore() |
| 1607 | + */ |
| 1608 | + public function zDeleteRangeByScore($key, $start, $end) {} |
| 1609 | + |
| 1610 | + /** |
| 1611 | + * Deletes the elements of the sorted set stored at the specified key which have rank in the range [start,end]. |
| 1612 | + * @param string $key |
| 1613 | + * @param long $start |
| 1614 | + * @param long $end |
| 1615 | + * @return LONG The number of values deleted from the sorted set |
| 1616 | + * @example |
| 1617 | + * $redis->zAdd('key', 1, 'one'); |
| 1618 | + * $redis->zAdd('key', 2, 'two'); |
| 1619 | + * $redis->zAdd('key', 3, 'three'); |
| 1620 | + * $redis->zRemRangeByRank('key', 0, 1); // 2 |
| 1621 | + * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3) |
| 1622 | + */ |
| 1623 | + public function zRemRangeByRank($key, $start, $end) {} |
| 1624 | + |
| 1625 | + /** |
| 1626 | + * @see zRemRangeByRank() |
| 1627 | + */ |
| 1628 | + public function zDeleteRangeByRank($key, $start, $end) {} |
| 1629 | + |
| 1630 | + /** |
| 1631 | + * Returns the cardinality of an ordered set. |
| 1632 | + * @param string $key |
| 1633 | + * @return Long, the set's cardinality |
| 1634 | + * @example |
| 1635 | + * $redis->zAdd('key', 0, 'val0'); |
| 1636 | + * $redis->zAdd('key', 2, 'val2'); |
| 1637 | + * $redis->zAdd('key', 10, 'val10'); |
| 1638 | + * $redis->zSize('key'); // 3 |
| 1639 | + */ |
| 1640 | + public function zSize($key) {} |
| 1641 | + |
| 1642 | + /** |
| 1643 | + * @see zSize() |
| 1644 | + */ |
| 1645 | + public function zCard($key) {} |
| 1646 | + |
| 1647 | + /** |
| 1648 | + * Returns the score of a given member in the specified sorted set. |
| 1649 | + * @param string $key |
| 1650 | + * @param string $member |
| 1651 | + * @return Double |
| 1652 | + * @example |
| 1653 | + * $redis->zAdd('key', 2.5, 'val2'); |
| 1654 | + * $redis->zScore('key', 'val2'); // 2.5 |
| 1655 | + */ |
| 1656 | + public function zScore($key, $member) {} |
| 1657 | + |
| 1658 | + /** |
| 1659 | + * Returns the rank of a given member in the specified sorted set, starting at 0 for the item |
| 1660 | + * with the smallest score. zRevRank starts at 0 for the item with the largest score. |
| 1661 | + * @param string $key |
| 1662 | + * @param string $member |
| 1663 | + * @return Long, the item's score. |
| 1664 | + * @example |
| 1665 | + * $redis->delete('z'); |
| 1666 | + * $redis->zAdd('key', 1, 'one'); |
| 1667 | + * $redis->zAdd('key', 2, 'two'); |
| 1668 | + * $redis->zRank('key', 'one'); // 0 |
| 1669 | + * $redis->zRank('key', 'two'); // 1 |
| 1670 | + * $redis->zRevRank('key', 'one'); // 1 |
| 1671 | + * $redis->zRevRank('key', 'two'); // 0 |
| 1672 | + */ |
| 1673 | + public function zRank($key, $member) {} |
| 1674 | + |
| 1675 | + /** |
| 1676 | + * @see zRank() |
| 1677 | + */ |
| 1678 | + public function zRevRank($key, $member) {} |
| 1679 | + |
| 1680 | + /** |
| 1681 | + * Increments the score of a member from a sorted set by a given amount. |
| 1682 | + * @param string $key |
| 1683 | + * @param double $value (double) value that will be added to the member's score |
| 1684 | + * @param string $member |
| 1685 | + * @return DOUBLE the new value |
| 1686 | + * @example |
| 1687 | + * $redis->delete('key'); |
| 1688 | + * $redis->zIncrBy('key', 2.5, 'member1'); // key or member1 didn't exist, so member1's score is to 0 |
| 1689 | + * // before the increment and now has the value 2.5 |
| 1690 | + * $redis->zIncrBy('key', 1, 'member1'); // 3.5 |
| 1691 | + */ |
| 1692 | + public function zIncrBy($key, $value, $member) {} |
| 1693 | + |
| 1694 | + /** |
| 1695 | + * Creates an union of sorted sets given in second argument. |
| 1696 | + * The result of the union will be stored in the sorted set defined by the first argument. |
| 1697 | + * The third optionnel argument defines weights to apply to the sorted sets in input. |
| 1698 | + * In this case, the weights will be multiplied by the score of each element in the sorted set |
| 1699 | + * before applying the aggregation. The forth argument defines the AGGREGATE option which |
| 1700 | + * specify how the results of the union are aggregated. |
| 1701 | + * @param string $Output |
| 1702 | + * @param array $ZSetKeys |
| 1703 | + * @param array $Weights |
| 1704 | + * @param type $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on duplicate entries during the zUnion. |
| 1705 | + * @return LONG The number of values in the new sorted set. |
| 1706 | + * @example |
| 1707 | + * $redis->delete('k1'); |
| 1708 | + * $redis->delete('k2'); |
| 1709 | + * $redis->delete('k3'); |
| 1710 | + * $redis->delete('ko1'); |
| 1711 | + * $redis->delete('ko2'); |
| 1712 | + * $redis->delete('ko3'); |
| 1713 | + * |
| 1714 | + * $redis->zAdd('k1', 0, 'val0'); |
| 1715 | + * $redis->zAdd('k1', 1, 'val1'); |
| 1716 | + * |
| 1717 | + * $redis->zAdd('k2', 2, 'val2'); |
| 1718 | + * $redis->zAdd('k2', 3, 'val3'); |
| 1719 | + * |
| 1720 | + * $redis->zUnion('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3') |
| 1721 | + * |
| 1722 | + * // Weighted zUnion |
| 1723 | + * $redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3') |
| 1724 | + * $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko1' => array('val0', 'val2', 'val3', 'val1') |
| 1725 | + */ |
| 1726 | + public function zUnion($Output, $ZSetKeys, $Weights, $aggregateFunction) {} |
| 1727 | + |
| 1728 | + /** |
| 1729 | + * Creates an intersection of sorted sets given in second argument. |
| 1730 | + * The result of the union will be stored in the sorted set defined by the first argument. |
| 1731 | + * The third optionnel argument defines weights to apply to the sorted sets in input. |
| 1732 | + * In this case, the weights will be multiplied by the score of each element in the sorted set |
| 1733 | + * before applying the aggregation. The forth argument defines the AGGREGATE option which |
| 1734 | + * specify how the results of the union are aggregated. |
| 1735 | + * @param string $Output |
| 1736 | + * @param array $ZSetKeys |
| 1737 | + * @param array $Weights |
| 1738 | + * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on duplicate entries during the zInter. |
| 1739 | + * @return LONG The number of values in the new sorted set. |
| 1740 | + * @example |
| 1741 | + * $redis->delete('k1'); |
| 1742 | + * $redis->delete('k2'); |
| 1743 | + * $redis->delete('k3'); |
| 1744 | + * |
| 1745 | + * $redis->delete('ko1'); |
| 1746 | + * $redis->delete('ko2'); |
| 1747 | + * $redis->delete('ko3'); |
| 1748 | + * $redis->delete('ko4'); |
| 1749 | + * |
| 1750 | + * $redis->zAdd('k1', 0, 'val0'); |
| 1751 | + * $redis->zAdd('k1', 1, 'val1'); |
| 1752 | + * $redis->zAdd('k1', 3, 'val3'); |
| 1753 | + * |
| 1754 | + * $redis->zAdd('k2', 2, 'val1'); |
| 1755 | + * $redis->zAdd('k2', 3, 'val3'); |
| 1756 | + * |
| 1757 | + * $redis->zInter('ko1', array('k1', 'k2')); // 2, 'ko1' => array('val1', 'val3') |
| 1758 | + * $redis->zInter('ko2', array('k1', 'k2'), array(1, 1)); // 2, 'ko2' => array('val1', 'val3') |
| 1759 | + * |
| 1760 | + * // Weighted zInter |
| 1761 | + * $redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3') |
| 1762 | + * $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1') |
| 1763 | + */ |
| 1764 | + public function zInter($Output, $ZSetKeys, $Weights, $aggregateFunction) {} |
| 1765 | + |
1573 | 1766 |
|
1574 | 1767 | }
|
0 commit comments