@@ -21,7 +21,7 @@ const getCustomCacheOptions = (connector, options) => {
2121 * @param {object } response the data to be cached
2222 * @return {object } the response, unchanged
2323 */
24- const addToCache = ( connector , key , uri , options , response ) => {
24+ export const addToCache = ( connector , key , uri , options , response ) => {
2525 if ( ! connector . enableCache ) {
2626 return ;
2727 }
@@ -53,7 +53,7 @@ const addToCache = (connector, key, uri, options, response) => {
5353 * @param {function } errorCB typically a Promise's `reject` function
5454 * @return {boolean } true if cached data was found, false otherwise
5555 */
56- const getCached = ( connector , key , successCB , errorCB ) => {
56+ export const getCached = ( connector , key , successCB , errorCB ) => {
5757 connector . redis . get ( key , ( error , data ) => {
5858 if ( error ) {
5959 errorCB ( error ) ;
@@ -71,7 +71,7 @@ const getCached = (connector, key, successCB, errorCB) => {
7171 } ) ;
7272} ;
7373
74- const isCacheEnabled = ( connector , options ) => {
74+ export const isCacheEnabled = ( connector , options ) => {
7575 if ( ! connector . redis || ! connector . enableCache ) {
7676 return false ;
7777 }
@@ -81,12 +81,13 @@ const isCacheEnabled = (connector, options) => {
8181 return true ;
8282} ;
8383
84- const refreshCache = ( connector , uri , options , key ) => {
84+ export const refreshCache = ( connector , uri , options , key ) => {
8585 connector . redis . get ( `${ REFRESH_CACHE_PREFIX_KEY } ${ key } ` , ( error , data ) => {
8686 if ( data !== 'true' ) {
8787 //Key expired, means it's time to refresh cache;
8888 connector . makeRequest ( uri , options , key ) ;
8989 }
9090 } ) ;
9191} ;
92- export { addToCache , isCacheEnabled , getCached , refreshCache } ;
92+
93+ export default { addToCache, isCacheEnabled, getCached, refreshCache } ;
0 commit comments