Delete an object in Redis using a pipeline.

    Deletes all fields defined by the template.

    Arguments:
        template: a dictionary containg the keys for the object and
            template strings for the corresponding redis keys. The template
            string uses named string interpolation format. Example:

            {
                'username': 'user:%(id)s:username',
                'email': 'user:%(id)s:email',
                'phone': 'user:%(id)s:phone'
            }

        indexes: a dictionary containing the values to use to construct the
            redis keys: Example:

            {
                'id': 342
            }

def delete_object(cache, template, indexes):
    """Delete an object in Redis using a pipeline.

    Deletes all fields defined by the template.

    Arguments:
        template: a dictionary containg the keys for the object and
            template strings for the corresponding redis keys. The template
            string uses named string interpolation format. Example:

            {
                'username': 'user:%(id)s:username',
                'email': 'user:%(id)s:email',
                'phone': 'user:%(id)s:phone'
            }

        indexes: a dictionary containing the values to use to construct the
            redis keys: Example:

            {
                'id': 342
            }


    """
    with cache as redis_connection:
        pipe = redis_connection.pipeline()
        for key in set(template.keys()):
            pipe.delete(template[key] % indexes)
        pipe.execute()