diff --git a/config.sample.js b/config.sample.js index a978af2..0072a04 100644 --- a/config.sample.js +++ b/config.sample.js @@ -44,18 +44,18 @@ module.exports = { as it would otherwise have to query database every single time. If enabled, but "contentDispositionOptions" is missing, it will use these defaults: - { limit: 50, strategy: 'lastGetTime' } + { limit: 50, strategy: 'LAST_GET_TIME' } */ setContentDisposition: false, contentDispositionOptions: { limit: 50, /* - Available strategies: lastGetTime, getsCount + Available strategies: LAST_GET_TIME, GETS_COUNT - lastGetTime: when cache store exceeds limit, remove cache with oldest access time - getsCount: when cache store exceeds limit, remove cache with fewest access count + LAST_GET_TIME: when cache store exceeds limit, remove cache with oldest access time + GETS_COUNT: when cache store exceeds limit, remove cache with fewest access count */ - strategy: 'lastGetTime' + strategy: 'LAST_GET_TIME' }, /* diff --git a/controllers/utils/SimpleDataStore.js b/controllers/utils/SimpleDataStore.js index 24d2503..512efe1 100644 --- a/controllers/utils/SimpleDataStore.js +++ b/controllers/utils/SimpleDataStore.js @@ -1,6 +1,6 @@ const STRATEGIES = [ - 'lastGetTime', - 'getsCount' + 'LAST_GET_TIME', + 'GETS_COUNT' ] class SimpleDataStore { @@ -122,3 +122,4 @@ class SimpleDataStore { } module.exports = SimpleDataStore +module.exports.STRATEGIES = STRATEGIES diff --git a/lolisafe.js b/lolisafe.js index 488e2e3..6bfd0d4 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -143,7 +143,7 @@ const initServeStaticUploads = (opts = {}) => { utils.contentDispositionStore = new SimpleDataStore( config.contentDispositionOptions || { limit: 50, - strategy: 'lastGetTime' + strategy: SimpleDataStore.STRATEGIES[0] } ) opts.preSetHeaders = async (res, req, path, stat) => {