@@ -7,12 +7,13 @@ import type { SimpleLog } from '../interface'
7
7
*/
8
8
export class CrossCheckerCacheManager extends SimpleStoreManager {
9
9
noLogIndex : boolean
10
-
10
+ storeKeyPrefix : string
11
11
addLog : any
12
12
13
- constructor ( store ?: Store , options ?: { noLogIndex ?: boolean } ) {
13
+ constructor ( store ?: Store , options ?: { noLogIndex ?: boolean ; storeKeyPrefix ?: string } ) {
14
14
super ( store )
15
15
this . noLogIndex = options ?. noLogIndex ?? false
16
+ this . storeKeyPrefix = options ?. storeKeyPrefix ?? ''
16
17
this . addLog = this . noLogIndex ? this . addLogWithoutLogIndex : this . addLogWithLogIndex
17
18
}
18
19
@@ -92,18 +93,18 @@ export class CrossCheckerCacheManager extends SimpleStoreManager {
92
93
93
94
// TODO: is this <txHashList, logIndexList> the most efficient internal storage format?
94
95
async getTxHashList ( ) {
95
- return await this . get < string [ ] > ( ' txHashList' )
96
+ return await this . get < string [ ] > ( ` ${ this . storeKeyPrefix } txHashList` )
96
97
}
97
98
98
99
async getLogIndexList ( ) {
99
- return await this . get < number [ ] [ ] > ( ' logIndexList' )
100
+ return await this . get < number [ ] [ ] > ( ` ${ this . storeKeyPrefix } logIndexList` )
100
101
}
101
102
102
103
async setTxHashList ( txHashList : string [ ] ) {
103
- await this . set ( ' txHashList' , txHashList )
104
+ await this . set ( ` ${ this . storeKeyPrefix } txHashList` , txHashList )
104
105
}
105
106
106
107
async setLogIndexList ( logIndexList : number [ ] [ ] ) {
107
- await this . set ( ' logIndexList' , logIndexList )
108
+ await this . set ( ` ${ this . storeKeyPrefix } logIndexList` , logIndexList )
108
109
}
109
110
}
0 commit comments