Skip to content

Implement Multi-Tenant Caching Strategy for Products#5

Closed
google-labs-jules[bot] wants to merge 1 commit intomainfrom
feat/product-caching-strategy-16835238056585694473
Closed

Implement Multi-Tenant Caching Strategy for Products#5
google-labs-jules[bot] wants to merge 1 commit intomainfrom
feat/product-caching-strategy-16835238056585694473

Conversation

@google-labs-jules
Copy link

This change implements a multi-tenant caching strategy for product data using the Next.js 'use cache' directive. It includes tenant-aware cache keys, granular cache tagging, and cache invalidation on data mutations.


PR created automatically by Jules for task 16835238056585694473 started by @S5SAJID

This commit introduces a comprehensive caching strategy for product data, adhering to modern Next.js patterns and ensuring strict multi-tenant data isolation.

Key changes:
-   **Introduced `'use cache'` Directive:** Refactored product data fetching to use the `'use cache'` directive, enabling server-side caching of product lists and individual product details.
-   **Tenant-Aware Caching:** All cached functions now accept a `storeId` as a parameter, which is incorporated into the cache key to guarantee that data is never shared between tenants.
-   **Granular Cache Tagging:** Implemented `cacheTag` to tag cached data with tenant- and resource-specific identifiers (e.g., `tenant-storeId:products`).
-   **Cache Invalidation:** Updated all mutation actions (create, update, delete) to invalidate the cache.

Known Limitations:
-   Due to encountering potential bugs or documentation mismatches with `revalidateTag` in the current Next.js version, this implementation uses `revalidatePath` for cache invalidation as a fallback. This is less granular than desired but ensures data consistency. Further investigation into `revalidateTag` is recommended as the framework stabilizes.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
s5arc Error Error Dec 19, 2025 4:50pm

@qodo-code-review
Copy link

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: biome_check

Failed stage: Install Dependencies [❌]

Failed test name: ""

Failure summary:

The action failed during npm install with npm error ERESOLVE due to a dependency/peer-dependency
conflict:
- The root project installs drizzle-orm@0.44.7 (drizzle-orm@"^0.44.5").
-
better-auth@1.4.7 declares an optional peer dependency drizzle-orm@"^0.41.0", which conflicts with
0.44.7.
- As a result, npm cannot resolve a compatible dependency tree and exits with code 1 (see
log lines 129–159).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

114:  node-version: 20
115:  always-auth: false
116:  check-latest: false
117:  token: ***
118:  ##[endgroup]
119:  Found in cache @ /opt/hostedtoolcache/node/20.19.6/x64
120:  ##[group]Environment details
121:  node: v20.19.6
122:  npm: 10.8.2
123:  yarn: 1.22.22
124:  ##[endgroup]
125:  ##[group]Run npm install
126:  �[36;1mnpm install�[0m
127:  shell: /usr/bin/bash -e {0}
128:  ##[endgroup]
129:  npm error code ERESOLVE
130:  npm error ERESOLVE could not resolve
131:  npm error
132:  npm error While resolving: better-auth@1.4.7
133:  npm error Found: drizzle-orm@0.44.7
134:  npm error node_modules/drizzle-orm
135:  npm error   drizzle-orm@"^0.44.5" from the root project
136:  npm error   peer drizzle-orm@">=0.36.0" from drizzle-zod@0.8.3
137:  npm error   node_modules/drizzle-zod
138:  npm error     drizzle-zod@"^0.8.3" from the root project
139:  npm error
140:  npm error Could not resolve dependency:
141:  npm error peerOptional drizzle-orm@"^0.41.0" from better-auth@1.4.7
142:  npm error node_modules/better-auth
143:  npm error   better-auth@"^1.4.7" from the root project
144:  npm error
145:  npm error Conflicting peer dependency: drizzle-orm@0.41.0
146:  npm error node_modules/drizzle-orm
147:  npm error   peerOptional drizzle-orm@"^0.41.0" from better-auth@1.4.7
148:  npm error   node_modules/better-auth
149:  npm error     better-auth@"^1.4.7" from the root project
150:  npm error
151:  npm error Fix the upstream dependency conflict, or retry
152:  npm error this command with --force or --legacy-peer-deps
153:  npm error to accept an incorrect (and potentially broken) dependency resolution.
154:  npm error
155:  npm error
156:  npm error For a full report see:
157:  npm error /home/runner/.npm/_logs/2025-12-19T16_49_45_313Z-eresolve-report.txt
158:  npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-12-19T16_49_45_313Z-debug-0.log
159:  ##[error]Process completed with exit code 1.
160:  Post job cleanup.

@S5SAJID S5SAJID closed this Dec 21, 2025
@S5SAJID S5SAJID deleted the feat/product-caching-strategy-16835238056585694473 branch December 21, 2025 05:03
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.

1 participant