Commit Graph
5 Commits
Author SHA1 Message Date
327bd9468a examples: cache-handler example should reconnect to redis after errors (#68221)
Co-authored-by: Arseny <[email protected]>
Co-authored-by: Lee Robinson <[email protected]>
2024-08-15 11:43:13 -05:00
0d3a353dfb fix[examples]: update example cache-handler-redis (#67350)
### What?

Fix cache-handler-redis example with working cache handler 

### Why?

It was not working because next-shared-cache was updated but some code
inside the cache-handler.js was deprecated after version 1.0.0.

When starting the app without Redis the cache handler was not switching
to the LRU handler.

### How?

- Updated cache-handler-redis example with working cache handler from
[next-shared-cache's
example](https://caching-tools.github.io/next-shared-cache/redis)
- Add check for PHASE_PRODUCTION_BUILD to avoid [issues while building
](https://github.com/caching-tools/next-shared-cache/issues/284#issuecomment-1919145094)
- Add throw error for Redis error to switch to the LRU handler
- Updated dependencies
- Updated readme broken links
- Remove "version" from docker-compose's file because it's outdated
[version outdated](https://github.com/docker/compose/issues/11628)

Closes NEXT-66812
Fixes #66812

Co-authored-by: Delba de Oliveira <[email protected]>
2024-07-18 13:57:54 +01:00
7725047c89 update cache handler version in example (#65330)
### What?
Update the cache-handler package to the latest and changed logic for
opting out of caching during build.

### Why?
The current implementation in the cache-handler-redis example requires
an environment variable check for `REDIS_AVAILABLE` to determine if the
server has already started in order to opt out of caching during build.
This update leverages the `NEXT_PHASE` environment variable instead.

### How?
This updates the environment variable check to leverage the `NEXT_PHASE`
variable so a user doesn't have to manage a new environment variable.

---------

Co-authored-by: JJ Kasper <[email protected]>
2024-05-13 14:58:55 -07:00
10599a4e1e fix(examples): cache-handler-redis implementation may cause error "Socket already opened" on production (#61978)
### What?

I copied the contents of `cache-handler.js` and tried it, and got an
error `"Socket already opened"`.
ref: https://github.com/caching-tools/next-shared-cache/issues/284
It should be fixed so that it doesn't matter if it is copied.

### Why?

Because `Socket already opened`, so a condition is needed before `await
client.connect()`.

### How?

Add environment variable(`process.env.REDIS_AVAILABLE`) check.
ref:
https://caching-tools.github.io/next-shared-cache/configuration/opt-out-cache-on-build

Co-authored-by: akfm.sato <[email protected]>
2024-02-13 23:45:11 +00:00
ArsenyandGitHub 3b46f22bb1 Update Redis Cache example with stabilized API (#60800)
This pull request updates the `cache-handler-redis` example with a
stabilized API. The updated `next.config.js` now uses the stable
`cacheHandler` option instead of the
`experimental.incrementalCacheHandlerPath`.
2024-01-21 02:40:54 +00:00