Skip to content

Commit 4472a23

Browse files
committed
feat: add storeKeyPrefix
1 parent 6496140 commit 4472a23

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/reku/event/crosschecker/cache/manager.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import type { SimpleLog } from '../interface'
77
*/
88
export class CrossCheckerCacheManager extends SimpleStoreManager {
99
noLogIndex: boolean
10-
10+
storeKeyPrefix: string
1111
addLog: any
1212

13-
constructor(store?: Store, options?: { noLogIndex?: boolean }) {
13+
constructor(store?: Store, options?: { noLogIndex?: boolean; storeKeyPrefix?: string }) {
1414
super(store)
1515
this.noLogIndex = options?.noLogIndex ?? false
16+
this.storeKeyPrefix = options?.storeKeyPrefix ?? ''
1617
this.addLog = this.noLogIndex ? this.addLogWithoutLogIndex : this.addLogWithLogIndex
1718
}
1819

@@ -92,18 +93,18 @@ export class CrossCheckerCacheManager extends SimpleStoreManager {
9293

9394
// TODO: is this <txHashList, logIndexList> the most efficient internal storage format?
9495
async getTxHashList() {
95-
return await this.get<string[]>('txHashList')
96+
return await this.get<string[]>(`${this.storeKeyPrefix}txHashList`)
9697
}
9798

9899
async getLogIndexList() {
99-
return await this.get<number[][]>('logIndexList')
100+
return await this.get<number[][]>(`${this.storeKeyPrefix}logIndexList`)
100101
}
101102

102103
async setTxHashList(txHashList: string[]) {
103-
await this.set('txHashList', txHashList)
104+
await this.set(`${this.storeKeyPrefix}txHashList`, txHashList)
104105
}
105106

106107
async setLogIndexList(logIndexList: number[][]) {
107-
await this.set('logIndexList', logIndexList)
108+
await this.set(`${this.storeKeyPrefix}logIndexList`, logIndexList)
108109
}
109110
}

0 commit comments

Comments
 (0)