from django.core.cache import cache
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver

from .models import Contact


@receiver([post_save, post_delete], sender=Contact)
def _bust_contact_stats_cache(sender, **kwargs):
    cache.delete("contacts:stats")
