@soulcraft/brainy 3.40.0 → 3.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/utils/unifiedCache.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.40.1](https://github.com/soulcraftlabs/brainy/compare/v3.40.0...v3.40.1) (2025-10-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* correct cache eviction formula to prioritize high-value items ([8e7b52b](https://github.com/soulcraftlabs/brainy/commit/8e7b52bda98e637164e2fb321251c254d03cdf70))
|
|
11
|
+
|
|
5
12
|
## [3.40.0](https://github.com/soulcraftlabs/brainy/compare/v3.39.0...v3.40.0) (2025-10-13)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -157,9 +157,9 @@ export class UnifiedCache {
|
|
|
157
157
|
let victim = null;
|
|
158
158
|
let lowestScore = Infinity;
|
|
159
159
|
for (const [key, item] of this.cache) {
|
|
160
|
-
// Calculate value score: access frequency
|
|
160
|
+
// Calculate value score: access frequency * rebuild cost (higher is better)
|
|
161
161
|
const accessScore = (this.access.get(key) || 1);
|
|
162
|
-
const score = accessScore
|
|
162
|
+
const score = accessScore * item.rebuildCost;
|
|
163
163
|
if (score < lowestScore) {
|
|
164
164
|
lowestScore = score;
|
|
165
165
|
victim = key;
|
|
@@ -180,7 +180,7 @@ export class UnifiedCache {
|
|
|
180
180
|
evictForSize(bytesNeeded) {
|
|
181
181
|
const candidates = [];
|
|
182
182
|
for (const [key, item] of this.cache) {
|
|
183
|
-
const score = (this.access.get(key) || 1)
|
|
183
|
+
const score = (this.access.get(key) || 1) * item.rebuildCost;
|
|
184
184
|
candidates.push([key, score, item]);
|
|
185
185
|
}
|
|
186
186
|
// Sort by score (lower is worse)
|
|
@@ -250,7 +250,7 @@ export class UnifiedCache {
|
|
|
250
250
|
const candidates = [];
|
|
251
251
|
for (const [key, item] of this.cache) {
|
|
252
252
|
if (item.type === type) {
|
|
253
|
-
const score = (this.access.get(key) || 1)
|
|
253
|
+
const score = (this.access.get(key) || 1) * item.rebuildCost;
|
|
254
254
|
candidates.push([key, score, item]);
|
|
255
255
|
}
|
|
256
256
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "3.40.
|
|
3
|
+
"version": "3.40.1",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|