Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cache-handler-redis example dependencies #59458

Merged

Conversation

better-salmon
Copy link
Contributor

This pull request updates the dependencies in the cache-handler-redis example. It updates the versions of the @neshca/cache-handler, which introduces new features.

@better-salmon better-salmon requested review from a team as code owners December 10, 2023 13:55
@better-salmon better-salmon requested review from timeyoutakeit and delbaoliveira and removed request for a team December 10, 2023 13:55
@ijjk ijjk added the examples Issue was opened via the examples template. label Dec 10, 2023
@ijjk
Copy link
Member

ijjk commented Dec 10, 2023

Allow CI Workflow Run

  • approve CI run for commit: e0e9ef1

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@ijjk
Copy link
Member

ijjk commented Dec 10, 2023

Allow CI Workflow Run

  • approve CI run for commit: da6f80c

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

useTtl,
})

const localCache = createLruCache({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for redisCache and localCache enable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ezeparziale! If Redis fails, you can use it as a fallback instead of a slow file system. But if you use a shared file system setup, you should turn it off. I added a new section to the docs.

Copy link

@ezeparziale ezeparziale Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for prompt reply!

I think this the best approach to run in k8s with some replicas is:

IncrementalCache.onCreation(async () => {
    let redisCache, localCache;

    const useTtl = true;

    if (process.env.REDIS_AVAILABLE) {
        await client.connect();
 
        redisCache = await createRedisCache({
            client,
            useTtl,
        });
     
        localCache = createLruCache({
            useTtl,
        });
    }

    const cache = [redisCache, localCache];
    
    return {
        cache,
        useFileSystem: false
    };
});

@better-salmon better-salmon force-pushed the update-cache-handler-example branch from e0e9ef1 to da6f80c Compare December 12, 2023 17:08
@leerob
Copy link
Member

leerob commented Jan 6, 2024

Lint is failing here, could you address please?

@better-salmon better-salmon force-pushed the update-cache-handler-example branch from ce81958 to ee849ba Compare January 9, 2024 16:28
@better-salmon
Copy link
Contributor Author

Hi @leerob! I have rebased the branch and double-checked that pnpm lint is passing without issues.

@delbaoliveira delbaoliveira merged commit 8694ed6 into vercel:canary Jan 10, 2024
30 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2024
@better-salmon better-salmon deleted the update-cache-handler-example branch August 15, 2024 19:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants