本文整理汇总了Python中past.model.user.User._clear_cache方法的典型用法代码示例。如果您正苦于以下问题:Python User._clear_cache方法的具体用法?Python User._clear_cache怎么用?Python User._clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类past.model.user.User
的用法示例。
在下文中一共展示了User._clear_cache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_user
# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import _clear_cache [as 别名]
def remove_user(uid):
user = User.get(uid)
if not user:
print '---no user:%s' % uid
print "---- delete from user, uid=", uid
db_conn.execute("delete from user where id=%s", uid)
db_conn.commit()
User._clear_cache(uid)
cursor = db_conn.execute("select id from status where user_id=%s", uid)
if cursor:
rows = cursor.fetchall()
for row in rows:
sid = row[0]
print "---- delete mongo text, sid=", sid
RawStatus.remove(sid)
print "---- delete from status, uid=", uid
db_conn.execute("delete from status where user_id=%s", uid)
db_conn.commit()
Status._clear_cache(uid, None)
print "---- delete from passwd, uid=", uid
db_conn.execute("delete from passwd where user_id=%s", uid)
print "---- delete from sync_task, uid=", uid
db_conn.execute("delete from sync_task where user_id=%s", uid)
print "---- delete from user_alias, uid=", uid
db_conn.execute("delete from user_alias where user_id=%s", uid)
db_conn.commit()
示例2: remove_user
# 需要导入模块: from past.model.user import User [as 别名]
# 或者: from past.model.user.User import _clear_cache [as 别名]
def remove_user(uid, clear_status=True):
user = User.get(uid)
if not user:
print "---no user:%s" % uid
suicide_log.info("---- delete from user, uid=%s" % uid)
db_conn.execute("delete from user where id=%s", uid)
db_conn.commit()
User._clear_cache(uid)
if clear_status:
cursor = db_conn.execute("select id from status where user_id=%s", uid)
if cursor:
rows = cursor.fetchall()
for row in rows:
sid = row[0]
suicide_log.info("---- delete status text, sid=%s" % sid)
RawStatus.remove(sid)
suicide_log.info("---- delete from status, uid=" % uid)
db_conn.execute("delete from status where user_id=%s", uid)
db_conn.commit()
Status._clear_cache(uid, None)
suicide_log.info("---- delete from passwd, uid=%s" % uid)
db_conn.execute("delete from passwd where user_id=%s", uid)
suicide_log.info("---- delete from sync_task, uid=%s" % uid)
db_conn.execute("delete from sync_task where user_id=%s", uid)
suicide_log.info("---- delete from user_alias, uid=%s" % uid)
db_conn.execute("delete from user_alias where user_id=%s", uid)
db_conn.commit()