studio icon indicating copy to clipboard operation
studio copied to clipboard

Utilities to clear recommendations cache

Open bjester opened this issue 1 year ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Current behavior

When Studio queries the Curriculum Automation API for recommendations, it caches the results in a table defined by the model RecommendationsCache. If a channel in the Kolibri Content Library (a public channel) changes and is republished, new recommendations could be applicable and old recommendations could be invalid.

Desired behavior

  • A Django management should be created that:
    • should delete all data from the RecommendationsCache
  • A utility function should be created that:
    • should accept a channel_id as an argument
    • should find all request_hash that have records with a matching channel_id
    • should delete all records with those request_hash
    • should be called during channel publishing, for that channel, when delete_public_channel_cache_keys() is called

Value add

  • Allows us to do targeted cache clearing for prior recommendation requests that had recommendations from recently updated and published channels
  • Allows us to do full cache clearing on a schedule, which will allow matching new recommendations for content that wasn't previously recommended

Possible tradeoffs

  • Ideally, we release performance improvement prior to doing more aggressive cache clearing
  • Targeted cache clearing doesn't cover all situations and may not be worthwhile long-term, but probably worthwhile until we better understand our performance limitations

bjester avatar Nov 20 '25 19:11 bjester

Automatically unassigning @ozer550 due to no comments here, or updates on the associated pull request for 1 month. @ozer550, if you're still interested in this issue or already have work in progress, please message us here, and we'll assign you again. Thank you!

learning-equality-bot avatar May 11 '26 00:05 learning-equality-bot