.BANCHO. Move bancho sessions to redis

This commit is contained in:
Nyo 2016-11-20 13:03:07 +01:00
parent 3bc390e3e6
commit 525235a27e
3 changed files with 8 additions and 3 deletions

2
common

@ -1 +1 @@
Subproject commit 369415b54e0dd8892fe557f0b7fb29c3933fc19e
Subproject commit 1dce6bc5b40fdfaca3064d5f2d23ca7dd1598256

View File

@ -185,12 +185,16 @@ class tokenList:
def deleteBanchoSessions(self):
"""
Truncate bancho_sessions table.
Remove all `peppy:sessions:*` redis keys.
Call at bancho startup to delete old cached sessions
:return:
"""
glob.db.execute("TRUNCATE TABLE bancho_sessions")
try:
# TODO: Make function or some redis meme
glob.redis.eval("return redis.call('del', unpack(redis.call('keys', ARGV[1])))", 0, "peppy:sessions:*")
except:
pass
def tokenExists(self, username = "", userID = -1):

1
pep.py
View File

@ -114,6 +114,7 @@ if __name__ == "__main__":
# Empty redis cache
try:
# TODO: Make function or some redis meme
glob.redis.eval("return redis.call('del', unpack(redis.call('keys', ARGV[1])))", 0, "peppy:*")
except redis.exceptions.ResponseError:
# Script returns error if there are no keys starting with peppy:*