Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 1.71 KB

cache-handler.md

File metadata and controls

59 lines (38 loc) · 1.71 KB

Development Setup for @neshca/cache-handler

Before diving into development, setting up the monorepo environment is essential. Please follow the instructions in the monorepo setup guide to ensure you start on the right foot.

Redis Integration for Development

Using Redis during development provides the distinct benefit of cache inspection and understanding its behavior via Redis Insight.

To integrate Redis as a cache store:

  1. Launch a Redis Instance using Docker:

    docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
  2. Setting Up the Local Environment:

    Create a .env.local file in the apps/cache-testing directory and define the REDIS_URL environment variable:

    REDIS_URL=redis://localhost:6379
  3. Starting Development Servers:

    To test changes in @neshca/cache-handler, utilize the @repo/cache-testing app. Due to this app's implementation of SSG and ISR, initiate the local backend first:

    pnpm dev:packages

    Subsequently, in a distinct terminal, compile and launch the @repo/cache-testing app:

    pnpm build:test-app
    pnpm start:test-app

    Note: Always rebuild @repo/cache-testing after every rebuild of @neshca/cache-handler.

Running Tests Locally

Initiate local tests with:

pnpm -F @repo/cache-testing playwright:install
pnpm -F @repo/cache-testing e2e:ui

Important: Clear the Redis DB before executing tests:

docker exec -it cache-handler-redis redis-cli
127.0.0.1:6379> flushall
OK

Your contributions to @neshca/cache-handler are invaluable. I appreciate your commitment to maintaining high standards.