*Move cachedDb to dedicated file

This commit is contained in:
Derrick Hammer 2022-08-15 09:50:44 -04:00
parent 8a6ec42fa6
commit dfed76acc5
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 8 additions and 7 deletions

View File

@ -22,7 +22,7 @@ import {
CONTENT_MODE_CHUNKED, CONTENT_MODE_CHUNKED,
contentModes, contentModes,
} from "../mimes.js"; } from "../mimes.js";
import Dexie from "dexie"; import { cacheDb } from "../databases.js";
const INDEX_HTML_FILES = ["index.html", "index.htm", "index.shtml"]; const INDEX_HTML_FILES = ["index.html", "index.htm", "index.shtml"];
@ -87,12 +87,6 @@ interface StatFileSubfile {
size: number; size: number;
} }
const cacheDb = new Dexie("LumeWebIFSCache");
cacheDb.version(1).stores({
items: `url,contentType,data,timestamp`,
});
const MAX_CACHE_SIZE = 1024 * 1024 * 1024 * 50; const MAX_CACHE_SIZE = 1024 * 1024 * 1024 * 50;
export default class IpfsProvider extends BaseProvider { export default class IpfsProvider extends BaseProvider {

7
src/databases.ts Normal file
View File

@ -0,0 +1,7 @@
import Dexie from "dexie";
export const cacheDb = new Dexie("LumeWebIFSCache");
cacheDb.version(1).stores({
items: `url,contentType,data,timestamp`,
});