diff options
| author | Max Isom <[email protected]> | 2021-11-18 20:50:44 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2021-11-18 20:50:44 -0500 |
| commit | d805da906a1744c23e0b484b522b078102675770 (patch) | |
| tree | 62f38c15383e13fa3b868ce47c3ce56344b345f6 /src/services | |
| parent | 381ee62b780f546b5c7652741bbeb9a36add2939 (diff) | |
| download | muse-d805da906a1744c23e0b484b522b078102675770.tar.xz muse-d805da906a1744c23e0b484b522b078102675770.zip | |
Rename existing cache model
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/cache.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/services/cache.ts b/src/services/cache.ts index e877c56..95c6731 100644 --- a/src/services/cache.ts +++ b/src/services/cache.ts @@ -1,5 +1,5 @@ import {injectable} from 'inversify'; -import {Cache} from '../models/index.js'; +import {KeyValueCache} from '../models/index.js'; import debug from '../utils/debug.js'; type Seconds = number; @@ -29,7 +29,7 @@ export default class CacheProvider { throw new Error(`Cache key ${key} is too short.`); } - const cachedResult = await Cache.findByPk(key); + const cachedResult = await KeyValueCache.findByPk(key); if (cachedResult) { if (new Date() < cachedResult.expiresAt) { @@ -45,7 +45,7 @@ export default class CacheProvider { const result = await func(...options as any[]); // Save result - await Cache.upsert({ + await KeyValueCache.upsert({ key, value: JSON.stringify(result), expiresAt: futureTimeToDate(expiresIn), |
