Skip to content

Commit

Permalink
change cache from 10 mins to 2 hours;
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanniser committed Oct 21, 2024
1 parent 0557b91 commit b27ebdf
Showing 1 changed file with 10 additions and 10 deletions.
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
);

0 comments on commit b27ebdf

Please sign in to comment.