-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
388fe9e
commit b5640fa
Showing
41 changed files
with
2,069 additions
and
1,811 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Global cache settings: | ||
* - `minTimeToStale` is the number of milliseconds until a cache entry is considered | ||
* stale, and is then refreshed | ||
* - `maxTimeToLive` is the number of milliseconds until a cache entry is considered | ||
* expired (by opposition to *stale*): if considered expired, it will not be returned, | ||
* it will be refreshed instead and will only return after this fresh invocation | ||
* | ||
* Our node-side swr utility bases its behavior on both those props. They can both be | ||
* overridden in individual swr calls (in practice, `minTimeToStale` is most overridden | ||
* the most often). | ||
* Redis only uses `maxTimeToLive` as its `expiry` prop. | ||
*/ | ||
|
||
const CACHE_SETTINGS = { | ||
minTimeToStale: 30 * 1000, // 30s | ||
maxTimeToLive: 24 * 60 * 60 * 1000, // 1d | ||
serialize: JSON.stringify, // serialize product object to string | ||
deserialize: JSON.parse, // deserialize cached product string to object | ||
}; | ||
|
||
export default CACHE_SETTINGS; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.