def checkForUser(userID, forceRefresh = False): cacheKey = userCacheKey(userID) userObject = memcache.get(cacheKey) if userObject is None or forceRefresh: userObject = appUsers.all().filter('userID = ', userID).get() if userObject is not None: memcache.set(cacheKey, userObject) return userObject
def getNicknames(newName = None): currentNicknamesList = memcache.get('currentNicknamesList') if currentNicknamesList is None: currentNicknamesList = [] allUsers = appUsers.all() for user in allUsers: currentNicknamesList.append(user.nickname) memcache.set('currentNicknamesList', currentNicknamesList) return currentNicknamesList
def getAllUsers(refresh = False): allUsers = memcache.get('allUsers') if allUsers is None or refresh: allUsers = [] users = appUsers.all() for user in users: allUsers.append(user.userID) memcache.set('allUsers', allUsers) return allUsers