warp-contracts-lmdb
Advanced tools
Comparing version 1.1.6 to 1.1.7
@@ -73,3 +73,3 @@ "use strict"; | ||
await this.db.transaction(() => { | ||
this.db.putSync(`${cacheKey.contractTxId}|${cacheKey.sortKey}`, value); | ||
this.db.put(`${cacheKey.contractTxId}|${cacheKey.sortKey}`, value); | ||
// Get number of elements that is already in cache. | ||
@@ -96,3 +96,3 @@ // +1 to account for the element we just put and will be inserted with this transaction | ||
.forEach((key) => { | ||
this.db.removeSync(key); | ||
this.db.remove(key); | ||
}); | ||
@@ -106,3 +106,3 @@ }); | ||
.forEach((key) => { | ||
this.db.removeSync(key); | ||
this.db.remove(key); | ||
}); | ||
@@ -109,0 +109,0 @@ }); |
{ | ||
"name": "warp-contracts-lmdb", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Lmdb database for Warp Contracts SDK", | ||
@@ -5,0 +5,0 @@ "types": "./lib/types/index.d.ts", |
@@ -17,3 +17,10 @@ # Warp Contracts Lmdb Cache | ||
Requires `warp-contracts` SDK ver. min. 1.2.17 | ||
### Custom options | ||
LmdbCache constructor accepts a second param with custom configuration. | ||
| Option | Required | Description | | ||
|-----------------------|------------|---------------------------------------------------------------------------------------------------------------------------------------| | ||
| maxEntriesPerContract | false | Maximum number of interactions stored per contract id - above this threshold adding another entry triggers removing old interactions. | | ||
| minEntriesPerContract | false | Minimum number of interactions stored per contract id. Value used when removing old iteractions. | | ||
### Usage | ||
@@ -30,8 +37,18 @@ | ||
dbLocation: `./cache/warp/state` | ||
}, { | ||
maxEntriesPerContract: 100, | ||
minEntriesPerContract: 10 | ||
} | ||
)) | ||
.useContractCache(new LmdbCache({ | ||
.useContractCache( | ||
// Contract cache | ||
new LmdbCache({ | ||
...defaultCacheOptions, | ||
dbLocation: `./cache/warp/contracts` | ||
}), | ||
// Source cache | ||
new LmdbCache({ | ||
...defaultCacheOptions, | ||
dbLocation: `./cache/warp/src` | ||
})); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20225
53