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.
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:
-
Launch a Redis Instance using Docker:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
-
Setting Up the Local Environment:
Create a
.env.local
file in theapps/cache-testing
directory and define theREDIS_URL
environment variable:REDIS_URL=redis://localhost:6379
-
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
.
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.