Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ const redisCacheHandler = createRedisHandler({

**Note:** Redis Cluster support is currently experimental and may have limitations or unexpected bugs. Use it with caution.

#### Redis Sentinel

```js
import { createSentinel } from "@redis/";
import createRedisHandler from "@fortedigital/nextjs-cache-handler/redis-strings";

const redisHandler = await createRedisHandler({
client: createSentinel({
url: process.env.REDIS_URL,
}),
keyPrefix: "myApp:",
sharedTagsKey: "myTags",
sharedTagsTtlKey: "myTagTtls",
});
```

**Note:** Redis Sentinel support is currently experimental and may have limitations or unexpected bugs. Use it with caution.

---

### `local-lru`
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs-cache-handler/src/handlers/redis-strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
convertStringsToBuffers,
parseBuffersToStrings,
} from "../helpers/buffer";
import type { RedisClientType } from "@redis/client";
import type { RedisClientType, RedisSentinelType } from "@redis/client";
import { RedisClusterCacheAdapter } from "../helpers/redisClusterAdapter";
import { withAbortSignalProxy } from "../helpers/withAbortSignalProxy";

Expand Down Expand Up @@ -34,7 +34,7 @@ export default function createHandler({
keyExpirationStrategy = "EXPIREAT",
revalidateTagQuerySize = 10_000,
}: CreateRedisStringsHandlerOptions<
RedisClientType | RedisClusterCacheAdapter
RedisClientType | RedisClusterCacheAdapter | RedisSentinelType
>): Handler {
const client = withAbortSignalProxy(innerClient);
const revalidatedTagsKey = keyPrefix + REVALIDATED_TAGS_KEY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RedisClientType } from "@redis/client";
import type { RedisClientType, RedisSentinelType } from "@redis/client";
import { RedisClusterCacheAdapter } from "../helpers/redisClusterAdapter";

export type RedisCompliantCachedRouteValue = {
Expand All @@ -15,7 +15,7 @@ export type RedisCompliantCachedAppPageValue = {
};

export type CreateRedisStringsHandlerOptions<
T = RedisClientType | RedisClusterCacheAdapter,
T = RedisClientType | RedisClusterCacheAdapter | RedisSentinelType,
> = {
/**
* The Redis client instance.
Expand Down