@@ -64,12 +64,16 @@ class Store:
6464 :param k: the key as a UTF-8 string
6565 :return: the value if it exists or None if it doesn't
6666 """
67- def search (
68- self , term : str , skip : Optional [int ] = None , limit : Optional [int ] = None
69- ) -> List [Tuple [str , str ]]:
67+ def search (self , term : str , skip : int = 0 , limit : int = 0 ) -> List [Tuple [str , str ]]:
7068 """
7169 Finds all key-values whose keys start with the substring `term`.
7270
71+ It skips the first `skip` (default: 0) number of results and returns not more than
72+ `limit` (default: 0) number of items. This is to avoid using up more memory than can be handled by the
73+ host machine.
74+ If `limit` is 0, all items are returned since it would make no sense for someone to search
75+ for zero items.
76+
7377 :param term: the starting substring to check all keys against
7478 :param skip: the number of the first matched key-value pairs to skip
7579 :param limit: the maximum number of records to return at any one given time
@@ -171,11 +175,17 @@ class AsyncStore:
171175 :return: the value if it exists or None if it doesn't
172176 """
173177 async def search (
174- self , term : str , skip : Optional [ int ] = None , limit : Optional [ int ] = None
178+ self , term : str , skip : int = 0 , limit : int = 0
175179 ) -> List [Tuple [str , str ]]:
176180 """
177181 Finds all key-values whose keys start with the substring `term`.
178182
183+ It skips the first `skip` (default: 0) number of results and returns not more than
184+ `limit` (default: 0) number of items. This is to avoid using up more memory than can be handled by the
185+ host machine.
186+ If `limit` is 0, all items are returned since it would make no sense for someone to search
187+ for zero items.
188+
179189 :param term: the starting substring to check all keys against
180190 :param skip: the number of the first matched key-value pairs to skip
181191 :param limit: the maximum number of records to return at any one given time
0 commit comments