Powered by SmartDoc

Basic control

Getting sessions

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....>

Getting and setting session data

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]

Saving sessions

Call CKApplication#save_sessionmethod to save sessions. However, it is unnecessary on automatic session management.

Closing or clearing sessions

Note the ways of deleting sessions are different in manual session management and automatic one. Call CKApplication#clear_sessionin manual, CKSession#clearin automatic.

CKSession#clearflags 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.