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

change cache from 10 mins to 2 hours #44

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
20 changes: 10 additions & 10 deletions src/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getProductsForSubcategory = unstable_cache(
}),
["subcategory-products"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -67,7 +67,7 @@ export const getCollections = unstable_cache(
}),
["collections"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -78,7 +78,7 @@ export const getProductDetails = unstable_cache(
}),
["product"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -89,7 +89,7 @@ export const getSubcategory = unstable_cache(
}),
["subcategory"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -107,7 +107,7 @@ export const getCategory = unstable_cache(
}),
["category"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -122,15 +122,15 @@ export const getCollectionDetails = unstable_cache(
}),
["collection"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

export const getProductCount = unstable_cache(
() => db.select({ count: count() }).from(products),
["total-product-count"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -152,7 +152,7 @@ export const getCategoryProductCount = unstable_cache(
.where(eq(categories.slug, categorySlug)),
["category-product-count"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand All @@ -164,7 +164,7 @@ export const getSubcategoryProductCount = unstable_cache(
.where(eq(products.subcategory_slug, subcategorySlug)),
["subcategory-product-count"],
{
revalidate: 600,
revalidate: 60 * 60 * 2, // two hours,
},
);

Expand Down Expand Up @@ -225,5 +225,5 @@ export const getSearchResults = unstable_cache(
return results;
},
["search-results"],
{ revalidate: 600 },
{ revalidate: 60 * 60 * 2 }, // two hours
);