def decrement_counter_post_save(sender, instance, **kwargs):
    if getattr(instance, "is_public", True) and not getattr(instance, "is_removed", False):
        key = get_cache_key_from_comment(instance)
        try:
            cache.decr(key)
        except ValueError:
            pass
def increment_counter(sender, comment, **kwargs):
    if getattr(comment, "is_public", True):
        key = get_cache_key_from_comment(comment)
        try:
            cache.incr(key)
        except ValueError:
            pass
def decrement_counter_flagged(sender, flag, comment, **kwargs):
    if flag.flag == flag.MODERATOR_DELETION and getattr(comment, "is_public", True):
        key = get_cache_key_from_comment(comment)
        try:
            cache.decr(key)
        except ValueError:
            pass