def unfollow_user(self, user): self.following.remove(user) # invalidate caches following_cache = UserFollowingCache(prekey=self.user.id) following_cache.invalidate_cache() followers_cache = UserFollowersCache(prekey=user.id) followers_cache.invalidate_cache()
def get_following(self): """Gets User following Returns a list of User objects """ c = UserFollowingCache(prekey=self.user.id) following = c.get() if following is None: following = self.following.all() c.cache_store(following) return following