Skip to content

feat: Add Fastify caching plugin adapter #7

Description

@Kareem411

🎯 Motivation

TriCache currently provides first-class adapters for Next.js, NestJS, Prisma, Drizzle, and raw HTTP (src/http/).

Adding a native Fastify plugin (tricache/fastify or src/fastify/) would make TriCache seamless for the high-performance Fastify ecosystem.


💡 Proposed Solution

Create a Fastify plugin that:

  1. Registers a fastify.cache decorator instance with TriCache CacheService.
  2. Supports route-level caching options:
    fastify.get('/users/:id', {
      config: {
        cache: {
          ttl: 60,
          tags: (req) => [`user:${req.params.id}`]
        }
      }
    }, handler);
  3. Automatically handles cache hits and responses with x-cache: HIT | MISS | STALE headers.

📂 Starting Points

Feel free to open a PR or comment if you would like to work on this!

Activity

  1. dyk1454683243-sudo commented on Sep 19, 2026

    @dyk1454683243-sudo
    Contributor

    Taking this as a first-class tricache/fastify package export plus dedicated tests/fastify.test.ts — not the Fastify example in #26 / #38, not Koa #10, and not Hono #9 / #45.

    Scope: additive src/fastify/ entry that re-exports the existing src/http/fastify plugin (createFastifyPlugin, fastifyCachePlugin, fastifyCache) so apps can import { … } from 'tricache/fastify' without going through tricache/http. tricache/http Fastify exports stay for back-compat. Branched from current upstream main (not stacked on open #36–#45 / dependabot).

  2. dyk1454683243-sudo commented on Sep 19, 2026

    @dyk1454683243-sudo
    Contributor

    Upstream PR: #46 — first-class tricache/fastify export + tests/fastify.test.ts (not example #26 / #38, not Koa #10, not Hono #9 / #45).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions