Skip to content

Commit

Permalink
refactor: remove redis test code from default config
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasio committed Apr 2, 2024
1 parent 34fc36b commit 6ffeea3
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions projects/wp-nextjs/headstartwp.config.server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const { getRedisClient } = require('@10up/next-redis-cache-provider');
const baseConfig = require('./headstartwp.config.client');

const redisClient = getRedisClient();

/**
* Config
*
Expand All @@ -11,22 +8,6 @@ const redisClient = getRedisClient();
module.exports = {
...baseConfig,
cache: {
enabled: ({ fetchStrategy }) => {
// cache app endpoints in-memory by default
return fetchStrategy.getEndpoint() === '/wp-json/headless-wp/v1/app';
},

/**
* @type {import('@headstartwp/core').FetchStrategyCacheHandler}
*/
cacheHandler: {
async set(key, data, ttl) {
return redisClient.set(key, JSON.stringify(data), 'EX', ttl);
},
async get(key) {
const data = await redisClient.get(key);
return JSON.parse(data);
},
},
enabled: false,
},
};

0 comments on commit 6ffeea3

Please sign in to comment.