# all files / lib/Enums/ default-ttls.js

100% Statements 11/11
100% Branches 0/0
100% Functions 0/0
100% Lines 10/10

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    321×

    1×

    1×
    1×
    1×
    11×
    83×

    83×

    1×

    1×
     import METHOD_NAMES from './method-names'

    const defaultTTLPerGroup = {
        CHAMPION_MASTERY: 60 * 60, // 1 hr
        CHAMPION: 60 * 60 * 24 * 7, // 7 days
        DDRAGON: 60 * 60 * 24 * 30, // 30 days
        LEAGUE: 60 * 60 * 12, // 12 hrs
        LOL_STATUS: 0,
        MATCH: 60 * 60 * 24 * 7, // 7 days,
        SPECTATOR: 0,
        SUMMONER: 60 * 60 * 24 * 7, // 7 days
        THIRD_PARTY_CODE: 0,
        TOURNAMENT_STUB: 0,
        TOURNAMENT: 0,
    }

    export const makeTTLsFromGroupedTTLs = obj => {
        const ttls = []
        Object.keys(obj).map(key => {
            Object.keys(METHOD_NAMES[key]).map(innerKey => {
                ttls.push({
                    [METHOD_NAMES[key][innerKey]]: obj[key],
                })
            })
        })
        return ttls.reduce((total, curr) => ({ ...total, ...curr }), {})
    }

    const defaults = makeTTLsFromGroupedTTLs(defaultTTLPerGroup)

    export default defaults