File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Redis } from 'ioredis' ;
2+
3+ import { REDIS_CONNECTION } from './config/redis' ;
4+
5+ export async function bustFileCache ( ) {
6+ const redis = new Redis ( REDIS_CONNECTION ) ;
7+
8+ console . debug ( 'DEV: Busting Redis cache for file urls' ) ;
9+ const cache_keys = await redis . keys ( 'file_service_url_caching*' ) ;
10+ console . debug ( `DEV: Removing ${ cache_keys . length } keys` ) ;
11+ cache_keys . forEach ( ( key ) => {
12+ redis . expire ( key , 0 ) ;
13+ } ) ;
14+ console . debug ( 'DEV: Done busting cache' ) ;
15+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
33import { fastify } from 'fastify' ;
44
55import registerAppPlugins from './app' ;
6+ import { bustFileCache } from './bustCache' ;
67import { DEV , NODE_ENV , PROD } from './config/env' ;
78import { client } from './drizzle/db' ;
89import ajvFormats from './schemas/ajvFormats' ;
@@ -66,6 +67,7 @@ const start = async () => {
6667 // greet the world
6768 // eslint-disable-next-line no-console
6869 console . log ( `${ GREETING } ` ) ;
70+ await bustFileCache ( ) ;
6971 }
7072 } catch ( err ) {
7173 instance . log . error ( err ) ;
You can’t perform that action at this time.
0 commit comments