Better cache invalidation for comparing LC reports

Summary

!18960 (merged)

Therefore we had to generate cache key To invalidate cache we have Ci::CompareLicenseScanningReportsService#key method. Part of the key is generated using SoftwareLicensePolicy#workaround_cache_key


 def self.workaround_cache_key
    pluck(:id, :approval_status).flatten
  end

Reason we do this instead of rails cache_key method is that SoftwareLicensePolicy table doesn't have created_at and updated_at columns.

Improvements

Add created_at and updated_at columns to the model and leverage them in code when generating key for reactive cache

Risks

We might need to do background migration

Involved components

  • Ci::CompareLicenseScanningReportsService
  • SoftwareLicensePolicy

Implementation Plan

Edited by Can Eldem