Session objects are get with CKApplication#session. The method returns a new session objects if session don't exist.
session = application.session p session #-> <CKSession:0x....>
You can get and set session data with the same interface as hash.
session['key'] = 'value' session['array'] = [1,2,3,4,5] p session['key'] #-> 'value' p session['array'] #-> [1,2,3,4,5]
Call CKApplication#save_session
method to save sessions. However, it is unnecessary on automatic session management.
Note the ways of deleting sessions are different in manual session management and automatic one. Call CKApplication#clear_session
in manual, CKSession#clear
in automatic.
CKSession#clear
flags for deleting sessions. A session data is deleted if you call the method, however the session is not deleted. The session is deleted completely when saving sessions by automatic session management.