'A signal handler to be called after saving a document. Does:
- trigger the cache invalidation of both the zone URLs and stack
cache for the given document
- trigger the cache invalidation of the contributor bar for the given
document
- trigger the renewal of the code sample job generation'

def on_document_save(self, sender, instance, **kwargs):

    async = kwargs.get('async', True)
    if hasattr(instance, 'zone'):
        invalidate_zone_urls_cache(instance.locale, async=async)
    invalidate_nearest_zone_cache(instance.pk, async=async)
    DocumentContributorsJob().invalidate(instance.pk)
    code_sample_job = DocumentCodeSampleJob(generation_args=[instance.pk])
    code_sample_job.invalidate_generation()
