mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix: hash all indexed keys
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import Storage from "./storage";
|
||||
import Indexer from "./indexer";
|
||||
import SparkMD5 from "spark-md5";
|
||||
|
||||
export default class PersistentCachedMap {
|
||||
/**
|
||||
@@ -19,6 +20,7 @@ export default class PersistentCachedMap {
|
||||
}
|
||||
|
||||
async set(key, value) {
|
||||
key = SparkMD5.hash(key);
|
||||
this.map.set(key, value);
|
||||
await this.indexer.write(key, value);
|
||||
await this.indexer.index(key);
|
||||
@@ -31,10 +33,12 @@ export default class PersistentCachedMap {
|
||||
}
|
||||
|
||||
get(key) {
|
||||
key = SparkMD5.hash(key);
|
||||
return this.map.get(key);
|
||||
}
|
||||
|
||||
has(key) {
|
||||
key = SparkMD5.hash(key);
|
||||
return this.map.has(key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user