-
Beta Was this translation helpful? Give feedback.
Answered by
erwanriou
Apr 11, 2024
Replies: 2 comments
-
UPDATE now my error is: And i still don't know why really. It remplaced axios with fetch and it started to show some cache logs. But now it cannot save them in redis :/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok i made it work.. and the solution was to use the const { CacheHandler } = require("@neshca/cache-handler")
const createRedisHandler = require("@neshca/cache-handler/redis-stack").default
const createLruHandler = require("@neshca/cache-handler/local-lru").default
const { createClient } = require("redis")
CacheHandler.onCreation(async () => {
const client = await createClient({ url: process.env.REDIS_URL })
.on("error", error => console.error("Redis error:", error?.message))
.connect()
const redisHandler = await createRedisHandler({ client, keyPrefix: process.env.NEXT_PUBLIC_HOSTNAME, timeoutMs: 5000 })
const localHandler = createLruHandler()
return { handlers: [redisHandler, localHandler] }
})
module.exports = CacheHandler even the last version of the library removed it, since i was doing this in js, well that a bit different |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
erwanriou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok i made it work.. and the solution was to use the
.default
for a js file...