Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-10048 annif-keyword cache tag invalidation #654

Merged
merged 13 commits into from
Jun 26, 2024
Merged

UHF-10048 annif-keyword cache tag invalidation #654

merged 13 commits into from
Jun 26, 2024

Conversation

rpnykanen
Copy link
Contributor

@rpnykanen rpnykanen commented Jun 24, 2024

UHF-10048

Update recommendations for old news when processing a set of keywords for new or existing news item.

What was done

Added cache tags for annif recommendations block.
Added cache invalidation when processing Annif-keyword request.

How to install

  • Make sure your instance is up and running on correct branch.
    • git checkout UHF-10048
    • make fresh
  • Run make drush-cr

How to test

  • Make sure your cache is working properly (no local.settings changes etc.)
  • Make sure you have the annif-block enabled.
  • Go to any news item page as incognito user
  • Open inspector and network tab and refresh the page
  • Check the response headers cache tags
    • You should see some of the Annif-keyword term ids mentioned in the response headers cache tags
      • For example taxonomy_term:1870

Cache invalidation:

  • Edit existing news item and save it
  • Figure out the best way to check which cache tags are invalidated
    • For example, xdebug
    • OR edit the code, add var_dump(array_merge(...$cacheTags)); or something at the end of invalidateKeywordTermsCacheTags -function in KeywordManager.php
  • Edit one of the news and run drush cron to trigger the keyword update
    • (the drush command won't update existing keywords if not mistaken)

You should see the an array of taxonomy_term:{term_id} to be invalidated.

Copy link

@rpnykanen rpnykanen merged commit 5f24992 into dev Jun 26, 2024
2 checks passed
@rpnykanen rpnykanen deleted the UHF-10048 branch June 26, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants