docs: def cache_invalidate_by_tags(tags, cache=None):
      """
      Clear cache by tags.
      """
      if isinstance(tags, basestring):
          tags = [tags]
      tag_keys = [CACHE_TAG_KEY % tag for tag in tags if tag]
      if not tag_keys:
          raise ValueError('Attr tags invalid')
      if cache is None:
          cache = default_cache
      tag_keys_for_delete = []
      if cache.__class__.__name__ == 'RedisCache':
          from django_redis.exceptions import ConnectionInterrupted
          try:
              redis_client = cache.client.get_client()
              for tag_key in tag_keys:
                  keys = redis_client.smembers(tag_key)
                  if keys:
                      cache.delete_many(keys)
                      tag_keys_for_delete.append(tag_key)
          except ConnectionInterrupted:
              pass  # todo add logging
      else:
          for tag_key in tag_keys:
              keys = cache.get(tag_key)
              if keys:
                  cache.delete_many(keys)
                  tag_keys_for_delete.append(tag_key)
      if tag_keys_for_delete:
          cache.delete_many(tag_keys_for_delete)