@receiver(SignalHandler.course_published)
def _listen_for_course_publish(sender, course_key, **kwargs):
 if switch_is_active(INVALIDATE_CACHE_ON_PUBLISH_SWITCH):
  clear_course_from_cache(course_key)
 update_course_in_cache.apply_async([unicode(course_key)], countdown=settings.BLOCK_STRUCTURES_SETTINGS['BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY'])

@ receiver ( SignalHandler . course_published ) def _listen_for_course_publish ( sender , course_key , ** kwargs ) : if switch_is_active ( INVALIDATE_CACHE_ON_PUBLISH_SWITCH ) : clear_course_from_cache ( course_key ) update_course_in_cache . apply_async ( [ unicode ( course_key ) ] , countdown = settings . BLOCK_STRUCTURES_SETTINGS [ 'BLOCK_STRUCTURES_COURSE_PUBLISH_TASK_DELAY' ] )
catches the signal that a course has been published in the module store and creates/updates the corresponding cache entry .