\Core\Common\ContainerIp2Region

Summary

Methods
Properties
Constants
__construct()
memorySearch()
binarySearch()
btreeSearch()
safeIp2long()
getLong()
__destruct()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$dbFileHandler
$HeaderSip
$HeaderPtr
$headerLen
$firstIndexPtr
$lastIndexPtr
$totalBlocks
$dbBinStr
$dbFile
N/A

Properties

$dbFileHandler

$dbFileHandler : 

db file handler

Type

$HeaderSip

$HeaderSip : 

header block info

Type

$HeaderPtr

$HeaderPtr : 

Type

$headerLen

$headerLen : 

Type

$firstIndexPtr

$firstIndexPtr : 

super block index info

Type

$lastIndexPtr

$lastIndexPtr : 

Type

$totalBlocks

$totalBlocks : 

Type

$dbBinStr

$dbBinStr : 

for memory mode only the original db binary string

Type

$dbFile

$dbFile : 

Type

Methods

__construct()

__construct(  $ip2regionFile) 

construct method

Parameters

$ip2regionFile

memorySearch()

memorySearch(  $ip) : array|null

all the db binary string will be loaded into memory then search the memory only and this will a lot faster than disk base search Note: invoke it once before put it to public invoke could make it thread safe

Parameters

$ip

Returns

array|null

binarySearch()

binarySearch(  $ip) : mixed

get the data block through the specified ip address or long ip numeric with binary search algorithm

Parameters

$ip

Returns

mixed —

Array or NULL for any error

btreeSearch()

btreeSearch(  $ip) : Mixed

get the data block associated with the specified ip with b-tree search algorithm Note: not thread safe

Parameters

$ip

Returns

Mixed —

Array for NULL for any error

safeIp2long()

safeIp2long(  $ip) : integer|string

safe self::safeIp2long function

Parameters

$ip

Returns

integer|string

getLong()

getLong(  $b,   $offset) : integer|string

read a long from a byte buffer

Parameters

$b
$offset

Returns

integer|string

__destruct()

__destruct() 

destruct method, resource destroy