|
2 | 2 |
|
3 | 3 | // [start-readme] |
4 | 4 | // |
5 | | -// Run this script to manually purge the Redis rendered page cache. |
| 5 | +// Run this script to manually "soft purge" the Redis rendered page cache |
| 6 | +// by shortening the expiration window of entries. |
6 | 7 | // This will typically only be run by Heroku during the deployment process, |
7 | 8 | // as triggered via our Procfile's "release" phase configuration. |
8 | 9 | // |
|
11 | 12 | require('dotenv').config() |
12 | 13 |
|
13 | 14 | const { promisify } = require('util') |
14 | | -const createClient = require('../lib/redis/create-client') |
| 15 | +const createRedisClient = require('../lib/redis/create-client') |
15 | 16 |
|
16 | 17 | const { REDIS_URL, HEROKU_RELEASE_VERSION, HEROKU_PRODUCTION_APP } = process.env |
17 | 18 | const isHerokuProd = HEROKU_PRODUCTION_APP === 'true' |
@@ -45,7 +46,7 @@ console.log({ |
45 | 46 | purgeRenderedPageCache() |
46 | 47 |
|
47 | 48 | function purgeRenderedPageCache () { |
48 | | - const redisClient = createClient({ |
| 49 | + const redisClient = createRedisClient({ |
49 | 50 | url: REDIS_URL, |
50 | 51 | db: pageCacheDatabaseNumber |
51 | 52 | }) |
@@ -143,7 +144,7 @@ function purgeRenderedPageCache () { |
143 | 144 | const pexpireAtPipeline = redisClient.batch() |
144 | 145 |
|
145 | 146 | keys.forEach((key, i) => { |
146 | | - // Only operate on -1 result values or those greater than ONE_HOUR_FROM_NOW |
| 147 | + // Only operate on -1 values or those later than our desired expiration timestamp |
147 | 148 | const pttl = pttlResults[i] |
148 | 149 | // A TTL of -1 means the entry was not configured with any TTL (expiration) |
149 | 150 | // currently and will remain as a permanent entry unless a TTL is added |
|
0 commit comments