smalltalk
/
osmo-st-all
Archived
1
0
Fork 0
This commit is contained in:
Nicolas Petton 2009-06-25 01:32:35 +00:00
parent 32578f7bde
commit 0229e6dd92
2 changed files with 14 additions and 21 deletions

View File

@ -358,13 +358,6 @@ IliadObject subclass: Session [
includesKey: self sessionManager cookieName) not includesKey: self sessionManager cookieName) not
] ]
removeYourself [
<category: 'removing'>
SessionManager current sessions
removeKey: self id asString
ifAbsent: []
]
addToDirtyWidgets: aWidget [ addToDirtyWidgets: aWidget [
<category: 'states'> <category: 'states'>
self dirtyWidgets add: aWidget self dirtyWidgets add: aWidget

View File

@ -91,6 +91,11 @@ To remove all expired sessions, call #removeExpiredSessions'>
^self preferenceAt: #actionKey ifAbsentPut: ['_action'] ^self preferenceAt: #actionKey ifAbsentPut: ['_action']
] ]
tokenKey [
<category: 'accessing preferences'>
^self preferenceAt: #tokenKey ifAbsentPut: ['_token']
]
cookieName [ cookieName [
<category: 'accessing preferences'> <category: 'accessing preferences'>
^self preferenceAt: #cookieName ifAbsentPut: ['_iliad685744'] ^self preferenceAt: #cookieName ifAbsentPut: ['_iliad685744']
@ -131,11 +136,6 @@ To remove all expired sessions, call #removeExpiredSessions'>
^self preferences at: #sessionClass put: aSessionClass ^self preferences at: #sessionClass put: aSessionClass
] ]
tokenKey [
<category: 'accessing preferences'>
^self preferenceAt: #tokenKey ifAbsentPut: ['_token']
]
addSession: aSession [ addSession: aSession [
<category: 'adding-removing'> <category: 'adding-removing'>
self sessions at: aSession id asString put: aSession self sessions at: aSession id asString put: aSession
@ -153,17 +153,11 @@ To remove all expired sessions, call #removeExpiredSessions'>
^self findSessionWithId: (self sessionIdFromRequest: aRequest) ^self findSessionWithId: (self sessionIdFromRequest: aRequest)
] ]
removeSession: aSession [
<category: 'adding-removing'>
aSession removeYourself
]
shouldRemoveExpiredSessions [ shouldRemoveExpiredSessions [
"Do not remove all expired sessions for each request, "Do not remove all expired sessions for each request"
so only answer true if sessions size modulo 10 equals 0"
<category: 'testing'> <category: 'testing'>
^(self sessions size \\ 10) = 0 ^(Random new next * 10) asInteger = 0
] ]
findSessionWithId: anId [ findSessionWithId: anId [
@ -190,11 +184,17 @@ To remove all expired sessions, call #removeExpiredSessions'>
^session ^session
] ]
removeSession: aSession [
<category: 'adding-removing'>
self sessions
removeKey: aSession id asString
ifAbsent: []
]
removeAllSessions [ removeAllSessions [
"Remove all sessions. Use for maintenance" "Remove all sessions. Use for maintenance"
<category: 'private'> <category: 'private'>
self sessions values do: [:each | self removeSession: each].
sessions := Dictionary new sessions := Dictionary new
] ]