System plugin DB queries run on every page load with no caching #38

Open
opened 2026-05-31 01:18:59 +00:00 by jmiller · 1 comment
Owner

Problem

MokoOG::onBeforeCompileHead() executes 1-3 database queries on every frontend page load:

  1. loadOgData() - always runs
  2. findImage() - runs if no custom image, queries #__content + potentially #__categories
  3. JsonLdBuilder::buildArticle() - queries #__content JOIN #__users

On a high-traffic site, this adds significant DB load with no caching.

Acceptance Criteria

  • Cache OG data lookups per content_type+content_id+language
  • Avoid duplicate article query (image + JSON-LD both query same article)
  • Use Joomla Cache API or per-request static cache
  • Cache invalidation on content save via content plugin hooks

Files

  • src/packages/plg_system_mokoog/src/Extension/MokoOG.php
  • src/packages/plg_system_mokoog/src/Helper/JsonLdBuilder.php
## Problem `MokoOG::onBeforeCompileHead()` executes 1-3 database queries on every frontend page load: 1. `loadOgData()` - always runs 2. `findImage()` - runs if no custom image, queries `#__content` + potentially `#__categories` 3. `JsonLdBuilder::buildArticle()` - queries `#__content` JOIN `#__users` On a high-traffic site, this adds significant DB load with no caching. ## Acceptance Criteria - [ ] Cache OG data lookups per content_type+content_id+language - [ ] Avoid duplicate article query (image + JSON-LD both query same article) - [ ] Use Joomla Cache API or per-request static cache - [ ] Cache invalidation on content save via content plugin hooks ## Files - `src/packages/plg_system_mokoog/src/Extension/MokoOG.php` - `src/packages/plg_system_mokoog/src/Helper/JsonLdBuilder.php`
jmiller added the enhancementpriority: mediumproduction-readiness labels 2026-05-31 01:18:59 +00:00
Author
Owner

Branch created: feature/38-system-plugin-db-queries-run-on-every-pa

git fetch origin
git checkout feature/38-system-plugin-db-queries-run-on-every-pa
Branch created: [`feature/38-system-plugin-db-queries-run-on-every-pa`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomOpenGraph/src/branch/feature/38-system-plugin-db-queries-run-on-every-pa) ```bash git fetch origin git checkout feature/38-system-plugin-db-queries-run-on-every-pa ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomOpenGraph#38