@@ -26,22 +26,6 @@ Tested versions are:
2626
2727Currently PPR, 'use cache', cacheLife and cacheTag are not tested. Use these operations with caution and your own risk.
2828
29- ## Available Options (needs Option B of getting started)
30-
31- | Option | Description | Default Value |
32- | ---------------------- | ----------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
33- | redis_url | Redis connection url | ` process.env.REDIS_URL? process.env.REDIS_URL : process.env.REDISHOST ? ` redis://${process.env.REDISHOST}:${process.env.REDISPORT}` : 'redis://localhost:6379' ` |
34- | database | Redis database number to use. Uses DB 0 for production, DB 1 otherwise | ` process.env.VERCEL_ENV === 'production' ? 0 : 1 ` |
35- | keyPrefix | Prefix added to all Redis keys | ` process.env.VERCEL_URL \|\| 'UNDEFINED_URL_' ` |
36- | sharedTagsKey | Key used to store shared tags hash map in Redis | ` '__sharedTags__' ` |
37- | timeoutMs | Timeout in milliseconds for Redis operations | ` 5000 ` |
38- | revalidateTagQuerySize | Number of entries to query in one batch during full sync of shared tags hash map | ` 250 ` |
39- | avgResyncIntervalMs | Average interval in milliseconds between tag map full re-syncs | ` 3600000 ` (1 hour) |
40- | redisGetDeduplication | Enable deduplication of Redis get requests via internal in-memory cache. | ` true ` |
41- | inMemoryCachingTime | Time in milliseconds to cache Redis get results in memory. Set this to 0 to disable in-memory caching completely. | ` 10000 ` |
42- | defaultStaleAge | Default stale age in seconds for cached items | ` 1209600 ` (14 days) |
43- | estimateExpireAge | Function to calculate expire age (redis TTL value) from stale age | Production: ` staleAge * 2 ` <br > Other: ` staleAge * 1.2 ` |
44-
4529## Getting started
4630
4731### Enable redis key-space notifications for Expire and Evict events
@@ -74,6 +58,8 @@ const nextConfig = {
7458}
7559```
7660
61+ Make sure to set either REDIS_URL or REDISHOST and REDISPORT environment variables.
62+
7763### Option B: create a wrapper file to change options
7864
7965create new file ` customized-cache-handler.js ` in your project root and add the following code:
@@ -127,6 +113,22 @@ const nextConfig = {
127113
128114A working example of above can be found in the ` test/integration/next-app-customized ` folder.
129115
116+ ## Available Options
117+
118+ | Option | Description | Default Value |
119+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120+ | redis_url | Redis connection url | ` process.env.REDIS_URL? process.env.REDIS_URL : process.env.REDISHOST ? redis://${process.env.REDISHOST}:${process.env.REDISPORT} : 'redis://localhost:6379' ` |
121+ | database | Redis database number to use. Uses DB 0 for production, DB 1 otherwise | ` process.env.VERCEL_ENV === 'production' ? 0 : 1 ` |
122+ | keyPrefix | Prefix added to all Redis keys | ` process.env.VERCEL_URL \|\| 'UNDEFINED_URL_' ` |
123+ | sharedTagsKey | Key used to store shared tags hash map in Redis | ` '__sharedTags__' ` |
124+ | timeoutMs | Timeout in milliseconds for Redis operations | ` 5000 ` |
125+ | revalidateTagQuerySize | Number of entries to query in one batch during full sync of shared tags hash map | ` 250 ` |
126+ | avgResyncIntervalMs | Average interval in milliseconds between tag map full re-syncs | ` 3600000 ` (1 hour) |
127+ | redisGetDeduplication | Enable deduplication of Redis get requests via internal in-memory cache. | ` true ` |
128+ | inMemoryCachingTime | Time in milliseconds to cache Redis get results in memory. Set this to 0 to disable in-memory caching completely. | ` 10000 ` |
129+ | defaultStaleAge | Default stale age in seconds for cached items | ` 1209600 ` (14 days) |
130+ | estimateExpireAge | Function to calculate expire age (redis TTL value) from stale age | Production: ` staleAge * 2 ` <br > Other: ` staleAge * 1.2 ` |
131+
130132## Consistency of Redis and this caching implementation
131133
132134To understand consistency levels of this caching implementation we first have to understand the consistency of redis itself:
@@ -168,7 +170,9 @@ By accepting and tolerating this eventual consistency, the performance of the ca
168170
169171## Testing
170172
171- To run all tests you can use the following command:
173+ Run ` pnpm run-dev-server ` to start the nextjs integration test project.
174+
175+ To run all tests you can use the following command in a second terminal:
172176
173177``` bash
174178pnpm test
0 commit comments