Skip to content

Utilities to clear recommendations cache #5565

@bjester

Description

@bjester

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions