mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[mod] RangeTable - fast lookup of a integer (IP) in a range table
This patch implements a table of ranges. A *range* is a series of integers, e.g. 0-10 with start value 0 and end value 10. Start and end values are stored in a two-column table, the RangeTable. This table is stored in Redis in a sorted list and a ZRANGEBYSCORE query can be used to determine if a particular integer is contained in one of the ranges in the table. The ZRANGEBYSCORE query scales with O(log(N)). To make it more clear: a query in a table with 1 million ranges takes just twice as long as the query in a table with 1000 ranges. A RangeTable is excellent for IP ranges and ultra-fast queries to see if an IP (which is nothing but an integer) is contained in one of the ranges of the table. Typical applications are e.g. large IP block lists or network ranges. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
01b5b9cb8e
commit
1184caa0fd
3 changed files with 251 additions and 5 deletions
|
|
@ -5,4 +5,5 @@ Redis Library
|
|||
=============
|
||||
|
||||
.. automodule:: searx.redislib
|
||||
:members:
|
||||
:members:
|
||||
:member-order: bysource
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue