MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / get

Method get

server/controllers/AuthCacheController.js:19–40  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

17 }
18
19 get(key) {
20 return db.AuthCache.findOne({
21 where: { key },
22 })
23 .then((cache) => {
24 if (!cache || !cache.createdAt) {
25 return new Promise((resolve) => resolve({}));
26 }
27 this.delete(key);
28 const timeDiff = moment().diff(cache.createdAt, "minutes");
29 // update this to match updateInterval from oneaccount library
30 // if it is changed (default value is 1 minute)
31 if (timeDiff > 1) {
32 return new Promise((resolve) => resolve({}));
33 }
34 return new Promise((resolve) => resolve(cache.toJSON().user));
35 })
36 .catch(() => {
37 // this operation shouldn't stop what else is running
38 return new Promise((resolve) => resolve({}));
39 });
40 }
41
42 delete(key) {
43 return db.AuthCache.destroy({ where: { key } })

Callers 9

findLastFunction · 0.45
sendRequestMethod · 0.45
joinDataFunction · 0.45
dataFilter.jsFile · 0.45
plotMethod · 0.45
operateMethod · 0.45
getTableDataMethod · 0.45
getConfigurationMethod · 0.45
DataExtractor.jsFile · 0.45

Calls 1

deleteMethod · 0.95

Tested by

no test coverage detected