class ActionDispatch::Session::CacheStore

def write_session(env, sid, session, options)

Set a session in the cache.
def write_session(env, sid, session, options)
  key = cache_key(sid.private_id)
  if session
    @cache.write(key, session, expires_in: options[:expire_after])
  else
    @cache.delete(key)
  end
  sid
end