Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openresty
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tangku7
openresty
Commits
89aa8f62
Commit
89aa8f62
authored
Jul 09, 2018
by
周尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize _BASE.db_read()
parent
00c25850
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
nginx/lua/base.lua
nginx/lua/base.lua
+4
-5
No files found.
nginx/lua/base.lua
View file @
89aa8f62
local
_BASE
=
{}
local
json
=
require
(
'cjson'
)
function
_BASE
.
print_log
(
fname
,
...
)
local
f
=
io.open
(
string.format
(
"/Users/zhoush/openresty/nginx/logs/%s_%s.log"
,
fname
,
os.date
(
"%Y%m%d"
)),
"a+"
)
local
str
=
""
...
...
@@ -15,15 +15,14 @@ function _BASE.print_log(fname, ...)
f
:
close
()
end
function
_BASE
.
db_read
()
local
f
=
io.open
(
"/Users/zhoush/openresty/nginx/conf/
dbs.json"
,
"r"
)
function
_BASE
.
db_read
(
dbpath
)
local
f
=
io.open
(
"/Users/zhoush/openresty/nginx/conf/
"
..
dbpath
,
"r"
)
local
tmp
=
f
:
read
(
"a*"
)
local
db_st
=
json
.
decode
(
tmp
)
f
:
close
()
return
db_st
end
function
_BASE
.
close_db
(
db
)
if
not
db
then
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment