Skip to content

Commit 47fc0ff

Browse files
author
Max Kamashev
committed
finished work
1 parent eef20d7 commit 47fc0ff

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed

redisphp.php

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,5 +1763,197 @@ public function zUnion($Output, $ZSetKeys, $Weights, $aggregateFunction) {}
17631763
*/
17641764
public function zInter($Output, $ZSetKeys, $Weights, $aggregateFunction) {}
17651765

1766+
/**
1767+
* Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
1768+
* @param string $key
1769+
* @param string $hashKey
1770+
* @param string $value
1771+
* @return LONG
1772+
* 1 if value didn't exist and was added successfully,
1773+
* 0 if the value was already present and was replaced, FALSE if there was an error.
1774+
* @example
1775+
* $redis->delete('h')
1776+
* $redis->hSet('h', 'key1', 'hello'); // 1, 'key1' => 'hello' in the hash at "h"
1777+
* $redis->hGet('h', 'key1'); // returns "hello"
1778+
*
1779+
* $redis->hSet('h', 'key1', 'plop'); // 0, value was replaced.
1780+
* $redis->hGet('h', 'key1'); // returns "plop"
1781+
*/
1782+
public function hSet($key, $hashKey, $value) {}
1783+
1784+
/**
1785+
* Adds a value to the hash stored at key only if this field isn't already in the hash.
1786+
* @param string $key
1787+
* @param string $hashKey
1788+
* @param string $value
1789+
* @return BOOL TRUE if the field was set, FALSE if it was already present.
1790+
* @example
1791+
* $redis->delete('h')
1792+
* $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
1793+
* $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field wasn't replaced.
1794+
*/
1795+
public function hSetNx($key, $hashKey, $value) {}
1796+
1797+
/**
1798+
* Gets a value from the hash stored at key. If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
1799+
* @param string $key
1800+
* @param string $hashKey
1801+
* @return STRING The value, if the command executed successfully BOOL FALSE in case of failure
1802+
* @example
1803+
*/
1804+
public function hGet($key, $hash) {}
1805+
1806+
/**
1807+
* Returns the length of a hash, in number of items
1808+
* @param string $key
1809+
* @return LONG the number of items in a hash, FALSE if the key doesn't exist or isn't a hash.
1810+
* @example
1811+
* $redis->delete('h')
1812+
* $redis->hSet('h', 'key1', 'hello');
1813+
* $redis->hSet('h', 'key2', 'plop');
1814+
* $redis->hLen('h'); // returns 2
1815+
*/
1816+
public function hLen($key) {}
1817+
1818+
/**
1819+
* Removes a value from the hash stored at key. If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
1820+
* @param type $key
1821+
* @param type $hashKey
1822+
* @return BOOL TRUE in case of success, FALSE in case of failure
1823+
* @example
1824+
*/
1825+
public function hDel($key, $hashKey) {}
1826+
1827+
/**
1828+
* Returns the keys in a hash, as an array of strings.
1829+
* @param type $key
1830+
* @return An array of elements, the keys of the hash. This works like PHP's array_keys().
1831+
* @example
1832+
* $redis->delete('h');
1833+
* $redis->hSet('h', 'a', 'x');
1834+
* $redis->hSet('h', 'b', 'y');
1835+
* $redis->hSet('h', 'c', 'z');
1836+
* $redis->hSet('h', 'd', 't');
1837+
* var_dump($redis->hKeys('h'));
1838+
*
1839+
* // Output:
1840+
* // array(4) {
1841+
* // [0]=>
1842+
* // string(1) "a"
1843+
* // [1]=>
1844+
* // string(1) "b"
1845+
* // [2]=>
1846+
* // string(1) "c"
1847+
* // [3]=>
1848+
* // string(1) "d"
1849+
* // }
1850+
* // The order is random and corresponds to redis' own internal representation of the set structure.
1851+
*/
1852+
public function hKeys($key) {}
1853+
1854+
/**
1855+
* Returns the values in a hash, as an array of strings.
1856+
* @param string $key
1857+
* @return An array of elements, the values of the hash. This works like PHP's array_values().
1858+
* @example
1859+
* $redis->delete('h');
1860+
* $redis->hSet('h', 'a', 'x');
1861+
* $redis->hSet('h', 'b', 'y');
1862+
* $redis->hSet('h', 'c', 'z');
1863+
* $redis->hSet('h', 'd', 't');
1864+
* var_dump($redis->hVals('h'));
1865+
*
1866+
* // Output
1867+
* // array(4) {
1868+
* // [0]=>
1869+
* // string(1) "x"
1870+
* // [1]=>
1871+
* // string(1) "y"
1872+
* // [2]=>
1873+
* // string(1) "z"
1874+
* // [3]=>
1875+
* // string(1) "t"
1876+
* // }
1877+
* // The order is random and corresponds to redis' own internal representation of the set structure.
1878+
*/
1879+
public function hVals($key) {}
1880+
1881+
1882+
/**
1883+
* Returns the whole hash, as an array of strings indexed by strings.
1884+
* @param type $key
1885+
* @return An array of elements, the contents of the hash.
1886+
* @example
1887+
* $redis->delete('h');
1888+
* $redis->hSet('h', 'a', 'x');
1889+
* $redis->hSet('h', 'b', 'y');
1890+
* $redis->hSet('h', 'c', 'z');
1891+
* $redis->hSet('h', 'd', 't');
1892+
* var_dump($redis->hGetAll('h'));
1893+
*
1894+
* // Output:
1895+
* // array(4) {
1896+
* // ["a"]=>
1897+
* // string(1) "x"
1898+
* // ["b"]=>
1899+
* // string(1) "y"
1900+
* // ["c"]=>
1901+
* // string(1) "z"
1902+
* // ["d"]=>
1903+
* // string(1) "t"
1904+
* // }
1905+
* // The order is random and corresponds to redis' own internal representation of the set structure.
1906+
*/
1907+
public function hGetAll($key) {}
1908+
1909+
/**
1910+
* Verify if the specified member exists in a key.
1911+
* @param string $key
1912+
* @param string $hashKey
1913+
* @return BOOL: If the member exists in the hash table, return TRUE, otherwise return FALSE.
1914+
* @example
1915+
* $redis->hSet('h', 'a', 'x');
1916+
* $redis->hExists('h', 'a'); // TRUE
1917+
* $redis->hExists('h', 'NonExistingKey'); // FALSE
1918+
*/
1919+
public function hExists($key, $hashKey) {}
1920+
1921+
/**
1922+
* Increments the value of a member from a hash by a given amount.
1923+
* @param string $key
1924+
* @param string $hashKey
1925+
* @param integer $value (integer) value that will be added to the member's value
1926+
* @return LONG the new value
1927+
* @example
1928+
* $redis->delete('h');
1929+
* $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
1930+
* $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
1931+
*/
1932+
public function hIncrBy($key, $hashKey, $value) {}
1933+
1934+
/**
1935+
* Fills in a whole hash. Non-string values are converted to string, using the standard (string) cast.
1936+
* NULL values are stored as empty strings
1937+
* @param string $key
1938+
* @param array $hashKeys key → value array
1939+
* @return BOOL
1940+
* @example
1941+
* $redis->delete('user:1');
1942+
* $redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));
1943+
* $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
1944+
*/
1945+
public function hMset($key, $hashKeys) {}
1946+
1947+
/**
1948+
* Retirieve the values associated to the specified fields in the hash.
1949+
* @param string $key
1950+
* @param array $hashKeys
1951+
* @return Array An array of elements, the values of the specified fields in the hash, with the hash keys as array keys.
1952+
* @example $redis->delete('h');
1953+
* $redis->hSet('h', 'field1', 'value1');
1954+
* $redis->hSet('h', 'field2', 'value2');
1955+
* $redis->hmGet('h', array('field1', 'field2')); // returns array('field1' => 'value1', 'field2' => 'value2')
1956+
*/
1957+
public function hMGet($key, $hashKeys) {}
17661958

17671959
}

0 commit comments

Comments
 (0)