mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-02-22 05:09:03 +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.
|
as it would otherwise have to query database every single time.
|
||||||
|
|
||||||
If enabled, but "contentDispositionOptions" is missing, it will use these defaults:
|
If enabled, but "contentDispositionOptions" is missing, it will use these defaults:
|
||||||
{ limit: 50, strategy: 'lastGetTime' }
|
{ limit: 50, strategy: 'LAST_GET_TIME' }
|
||||||
*/
|
*/
|
||||||
setContentDisposition: false,
|
setContentDisposition: false,
|
||||||
contentDispositionOptions: {
|
contentDispositionOptions: {
|
||||||
limit: 50,
|
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
|
LAST_GET_TIME: when cache store exceeds limit, remove cache with oldest access time
|
||||||
getsCount: when cache store exceeds limit, remove cache with fewest access count
|
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 = [
|
const STRATEGIES = [
|
||||||
'lastGetTime',
|
'LAST_GET_TIME',
|
||||||
'getsCount'
|
'GETS_COUNT'
|
||||||
]
|
]
|
||||||
|
|
||||||
class SimpleDataStore {
|
class SimpleDataStore {
|
||||||
@ -122,3 +122,4 @@ class SimpleDataStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SimpleDataStore
|
module.exports = SimpleDataStore
|
||||||
|
module.exports.STRATEGIES = STRATEGIES
|
||||||
|
@ -143,7 +143,7 @@ const initServeStaticUploads = (opts = {}) => {
|
|||||||
utils.contentDispositionStore = new SimpleDataStore(
|
utils.contentDispositionStore = new SimpleDataStore(
|
||||||
config.contentDispositionOptions || {
|
config.contentDispositionOptions || {
|
||||||
limit: 50,
|
limit: 50,
|
||||||
strategy: 'lastGetTime'
|
strategy: SimpleDataStore.STRATEGIES[0]
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
opts.preSetHeaders = async (res, req, path, stat) => {
|
opts.preSetHeaders = async (res, req, path, stat) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user