本文整理汇总了Python中stubo.cache.Cache.delete_session_data方法的典型用法代码示例。如果您正苦于以下问题:Python Cache.delete_session_data方法的具体用法?Python Cache.delete_session_data怎么用?Python Cache.delete_session_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stubo.cache.Cache
的用法示例。
在下文中一共展示了Cache.delete_session_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: end_session
# 需要导入模块: from stubo.cache import Cache [as 别名]
# 或者: from stubo.cache.Cache import delete_session_data [as 别名]
def end_session(handler, session_name):
response = {
'version' : version
}
cache = Cache(get_hostname(handler.request))
scenario_key = cache.get_scenario_key(session_name)
if not scenario_key:
# end/session?session=x called before begin/session
response['data'] = {
'message' : 'Session ended'
}
return response
host, scenario_name = scenario_key.split(':')
session = cache.get_session(scenario_name, session_name, local=False)
if not session:
# end/session?session=x called before begin/session
response['data'] = {
'message' : 'Session ended'
}
return response
handler.track.scenario = scenario_name
session_status = session['status']
if session_status not in ('record', 'playback'):
log.warn('expecting session={0} to be in record or playback for '
'end/session'.format(session_name))
session['status'] = 'dormant'
# clear stubs cache & scenario session data
session.pop('stubs', None)
cache.set(scenario_key, session_name, session)
cache.delete_session_data(scenario_name, session_name)
if session_status == 'record':
log.debug('store source recording to pre_scenario_stub')
store_source_recording(scenario_key, session_name)
response['data'] = {
'message' : 'Session ended'
}
return response