def check_script_sync(userId, c): if script_lock.acquire(1): key = 'script_%s' % userId script = redisDB.get(key) if c == script: return False redisDB.set(key, c) script_lock.release() return True
def check_category_sync(userId, c): if category_lock.acquire(1): key = 'category_%s' % userId category = redisDB.get(key) if c == category: return False redisDB.set(key, c) category_lock.release() return True