# This worker clears all cache fields in the database, working in batches.classClearDatabaseCacheWorkerincludeSidekiq::WorkerBATCH_SIZE=1000defperformCacheMarkdownField.caching_classes.eachdo|kls|fields=kls.cached_markdown_fields.html_fieldsclear_cache_fields=fields.each_with_object({})do|field,memo|memo[field]=nilendRails.logger.debug("Clearing Markdown cache for #{kls}: #{fields.inspect}")kls.unscoped.in_batches(of: BATCH_SIZE)do|relation|relation.update_all(clear_cache_fields)endendnilendend