Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe-git committed Dec 6, 2023
1 parent 388fe9e commit b5640fa
Show file tree
Hide file tree
Showing 41 changed files with 2,069 additions and 1,811 deletions.
22 changes: 22 additions & 0 deletions constants/CacheSettings.js
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;
210 changes: 210 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"form-urlencoded": "^6.0.4",
"graphql": "^15.5.1",
"graphql-request": "^6.1.0",
"ioredis": "^5.3.2",
"lodash.groupby": "^4.6.0",
"lodash.partition": "^4.6.0",
"lodash.uniq": "^4.5.0",
Expand All @@ -24,6 +25,7 @@
"next": "12.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"stale-while-revalidate-cache": "^3.2.1",
"web3": "^1.3.4"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit b5640fa

Please sign in to comment.