mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 22:29:01 +02:00
5b5c7ebd01
Update example project split test to new framework GitOrigin-RevId: 9b3f1cb2b7a84d0078abf9c748dcdf9c6c7637e1
26 lines
561 B
JavaScript
26 lines
561 B
JavaScript
const SplitTestManager = require('./SplitTestManager')
|
|
const { SplitTest } = require('../../models/SplitTest')
|
|
const { CacheLoader } = require('cache-flow')
|
|
|
|
class SplitTestCache extends CacheLoader {
|
|
constructor() {
|
|
super('split-test', {
|
|
expirationTime: 60, // 1min in seconds
|
|
})
|
|
}
|
|
|
|
async load(name) {
|
|
return await SplitTestManager.getSplitTestByName(name)
|
|
}
|
|
|
|
serialize(value) {
|
|
return value ? value.toObject() : undefined
|
|
}
|
|
|
|
deserialize(value) {
|
|
return new SplitTest(value)
|
|
}
|
|
}
|
|
|
|
module.exports = new SplitTestCache()
|