Skip to content

Commit 166236b

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 77e8937 + 04a1600 commit 166236b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

README.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ http {
1717
}
1818
location /start {
1919
content_by_lua '
20-
local session = require "resty.session".start()
20+
local session = require("resty.session").start()
2121
session.data.name = "OpenResty Fan"
2222
session:save()
2323
ngx.say("<html><body>Session started. ",
@@ -26,24 +26,25 @@ http {
2626
}
2727
location /test {
2828
content_by_lua '
29-
local session = require "resty.session".start()
29+
local session = require("resty.session").start()
3030
ngx.say("<html><body>Session was started by <strong>",
3131
session.data.name or "Anonymous",
3232
"</strong>! <a href=/destroy>Destroy the session</a>.</body></html>")
3333
';
3434
}
3535
location /destroy {
3636
content_by_lua '
37-
local session = require "resty.session".start()
37+
local session = require("resty.session").start()
3838
session:destroy()
3939
ngx.say("<html><body>Session was destroyed. ",
4040
"<a href=/check>Is it really so</a>?</body></html>")
4141
';
4242
}
4343
location /check {
4444
content_by_lua '
45-
local session = require "resty.session".start()
46-
ngx.say("<html><body>Session was really destroyed, you are known as <strong>",
45+
local session = require("resty.session").start()
46+
ngx.say("<html><body>Session was really destroyed, you are known as ",
47+
"<strong>",
4748
session.data.name or "Anonymous",
4849
"</strong>! <a href=/>Start again</a>.</body></html>")
4950
';
@@ -127,9 +128,9 @@ does also manage session cookie renewing configured with `$session_cookie_renew`
127128
with a new expiration time if the following is met `session.expires - now < session.cookie.renew`.
128129

129130
```lua
130-
local session = require "resty.session".start()
131+
local session = require("resty.session").start()
131132
-- Set some options (overwriting the defaults or nginx configuration variables)
132-
local session = require "resty.session".start{ identifier = { length = 32 }}
133+
local session = require("resty.session").start{ identifier = { length = 32 }}
133134
```
134135

135136
#### boolean session:regenerate(flush or nil)
@@ -143,7 +144,7 @@ actually happens when the cookie's expiration time is not valid anymore). This f
143144
value if everything went as planned (you may assume that it is always the case).
144145

145146
```lua
146-
local session = require "resty.session".start()
147+
local session = require("resty.session").start()
147148
session:regenerate()
148149
-- Flush the current data
149150
session:regenerate(true)
@@ -157,7 +158,7 @@ advised that you call this function only once per request (no need to encrypt an
157158
This function returns a boolean value if everything went as planned (you may assume that it is always the case).
158159

159160
```lua
160-
local session = require "resty.session".start()
161+
local session = require("resty.session").start()
161162
session.data.uid = 1
162163
session:save()
163164
```
@@ -170,7 +171,7 @@ should remove the cookie, and not send it back again). This function returns a b
170171
as planned (you may assume that it is always the case).
171172

172173
```lua
173-
local session = require "resty.session".start()
174+
local session = require("resty.session").start()
174175
session:destroy()
175176
```
176177

@@ -201,15 +202,15 @@ you need to call `session:save` method.
201202
**Setting session variable:**
202203

203204
```lua
204-
local session = require "resty.session".start()
205+
local session = require("resty.session").start()
205206
session.data.uid = 1
206207
session:save()
207208
```
208209

209210
**Retrieving session variable (in other request):**
210211

211212
```lua
212-
local session = require "resty.session".start()
213+
local session = require("resty.session").start()
213214
local uid = session.data.uid
214215
```
215216

0 commit comments

Comments
 (0)