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,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;wBAC9B,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;qBACjC;iBACF;aACF;iBAAM,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE;gBAClC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBAClC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBAC5B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBACxB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBACjC;aACF;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;aAClF;QACH,CAAC;KAAA;CACF;AA9BC;IADC,eAAM,CAAC,aAAK,CAAC,IAAI,CAAC;8BACZ,aAAK;2CAAC;AAvBf,oCAqDC","file":"CacheCommand.js","sourcesContent":["import * as _ from 'lodash';\nimport {ICommand} from '../libs/commands/ICommand';\nimport {Log} from '../libs/logging/Log';\nimport {Inject} from 'typedi';\nimport {Cache} from '../libs/cache/Cache';\nimport {System} from '../libs/system/System';\n\nexport class CacheCommand implements ICommand {\n\n\n command = 'cache [command] [bin]';\n\n aliases = 'cache';\n\n describe = 'Clear cache bins';\n\n\n builder(yargs: any) {\n return yargs;\n }\n\n beforeStartup(): void {\n System.enableDistribution(false);\n }\n\n beforeStorage(): void {\n Log.options({enable: false, loggers: [{name: '*', enable: false}]}, false);\n }\n\n @Inject(Cache.NAME)\n cache: Cache;\n\n\n async handler(argv: any) {\n if (argv.command === 'clear') {\n const bins = this.cache.getBins();\n if (argv.bin) {\n if (bins[argv.bin]) {\n console.log('clear bin ' + argv.bin);\n await bins[argv.bin].store.clearBin(argv.bin);\n } else {\n console.log('cache bin with name ' + argv.bin + ' not found.');\n }\n } else {\n for (const k of _.keys(bins)) {\n console.log('clear bin ' + k);\n await bins[k].store.clearBin(k);\n }\n }\n } else if (argv.command === 'bins') {\n const bins = this.cache.getBins();\n console.log('Active bins:');\n for (const k of _.keys(bins)) {\n console.log('\\t- ' + k);\n await bins[k].store.clearBin(k);\n }\n } else {\n console.log('no sub command found. Example: cache clear or cache clear someBin');\n }\n }\n}\n\n"],"sourceRoot":".."} |