mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-21 12:49:07 +00:00
refactor: SimpleDataStore.STRATEGIES
This commit is contained in:
parent
39aaa25f3f
commit
d31181b4be
@ -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'
|
||||
},
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user