gitx.do 0.0.2 → 0.0.3

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.
Files changed (237) hide show
  1. package/dist/cli/commands/blame.d.ts +259 -0
  2. package/dist/cli/commands/blame.d.ts.map +1 -0
  3. package/dist/cli/commands/blame.js +609 -0
  4. package/dist/cli/commands/blame.js.map +1 -0
  5. package/dist/cli/commands/branch.d.ts +249 -0
  6. package/dist/cli/commands/branch.d.ts.map +1 -0
  7. package/dist/cli/commands/branch.js +693 -0
  8. package/dist/cli/commands/branch.js.map +1 -0
  9. package/dist/cli/commands/commit.d.ts +182 -0
  10. package/dist/cli/commands/commit.d.ts.map +1 -0
  11. package/dist/cli/commands/commit.js +437 -0
  12. package/dist/cli/commands/commit.js.map +1 -0
  13. package/dist/cli/commands/diff.d.ts +464 -0
  14. package/dist/cli/commands/diff.d.ts.map +1 -0
  15. package/dist/cli/commands/diff.js +958 -0
  16. package/dist/cli/commands/diff.js.map +1 -0
  17. package/dist/cli/commands/log.d.ts +239 -0
  18. package/dist/cli/commands/log.d.ts.map +1 -0
  19. package/dist/cli/commands/log.js +535 -0
  20. package/dist/cli/commands/log.js.map +1 -0
  21. package/dist/cli/commands/review.d.ts +457 -0
  22. package/dist/cli/commands/review.d.ts.map +1 -0
  23. package/dist/cli/commands/review.js +533 -0
  24. package/dist/cli/commands/review.js.map +1 -0
  25. package/dist/cli/commands/status.d.ts +269 -0
  26. package/dist/cli/commands/status.d.ts.map +1 -0
  27. package/dist/cli/commands/status.js +493 -0
  28. package/dist/cli/commands/status.js.map +1 -0
  29. package/dist/cli/commands/web.d.ts +199 -0
  30. package/dist/cli/commands/web.d.ts.map +1 -0
  31. package/dist/cli/commands/web.js +696 -0
  32. package/dist/cli/commands/web.js.map +1 -0
  33. package/dist/cli/fs-adapter.d.ts +656 -0
  34. package/dist/cli/fs-adapter.d.ts.map +1 -0
  35. package/dist/cli/fs-adapter.js +1179 -0
  36. package/dist/cli/fs-adapter.js.map +1 -0
  37. package/dist/cli/index.d.ts +387 -0
  38. package/dist/cli/index.d.ts.map +1 -0
  39. package/dist/cli/index.js +523 -0
  40. package/dist/cli/index.js.map +1 -0
  41. package/dist/cli/ui/components/DiffView.d.ts +7 -0
  42. package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
  43. package/dist/cli/ui/components/DiffView.js +11 -0
  44. package/dist/cli/ui/components/DiffView.js.map +1 -0
  45. package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
  46. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
  47. package/dist/cli/ui/components/ErrorDisplay.js +11 -0
  48. package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
  49. package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
  50. package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
  51. package/dist/cli/ui/components/FuzzySearch.js +12 -0
  52. package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
  53. package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
  54. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
  55. package/dist/cli/ui/components/LoadingSpinner.js +10 -0
  56. package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
  57. package/dist/cli/ui/components/NavigationList.d.ts +9 -0
  58. package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
  59. package/dist/cli/ui/components/NavigationList.js +11 -0
  60. package/dist/cli/ui/components/NavigationList.js.map +1 -0
  61. package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
  62. package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
  63. package/dist/cli/ui/components/ScrollableContent.js +11 -0
  64. package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
  65. package/dist/cli/ui/components/index.d.ts +7 -0
  66. package/dist/cli/ui/components/index.d.ts.map +1 -0
  67. package/dist/cli/ui/components/index.js +9 -0
  68. package/dist/cli/ui/components/index.js.map +1 -0
  69. package/dist/cli/ui/terminal-ui.d.ts +52 -0
  70. package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
  71. package/dist/cli/ui/terminal-ui.js +121 -0
  72. package/dist/cli/ui/terminal-ui.js.map +1 -0
  73. package/dist/durable-object/object-store.d.ts +401 -23
  74. package/dist/durable-object/object-store.d.ts.map +1 -1
  75. package/dist/durable-object/object-store.js +414 -25
  76. package/dist/durable-object/object-store.js.map +1 -1
  77. package/dist/durable-object/schema.d.ts +188 -0
  78. package/dist/durable-object/schema.d.ts.map +1 -1
  79. package/dist/durable-object/schema.js +160 -0
  80. package/dist/durable-object/schema.js.map +1 -1
  81. package/dist/durable-object/wal.d.ts +336 -31
  82. package/dist/durable-object/wal.d.ts.map +1 -1
  83. package/dist/durable-object/wal.js +272 -27
  84. package/dist/durable-object/wal.js.map +1 -1
  85. package/dist/index.d.ts +379 -3
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +379 -7
  88. package/dist/index.js.map +1 -1
  89. package/dist/mcp/adapter.d.ts +579 -38
  90. package/dist/mcp/adapter.d.ts.map +1 -1
  91. package/dist/mcp/adapter.js +426 -33
  92. package/dist/mcp/adapter.js.map +1 -1
  93. package/dist/mcp/sandbox.d.ts +532 -29
  94. package/dist/mcp/sandbox.d.ts.map +1 -1
  95. package/dist/mcp/sandbox.js +389 -22
  96. package/dist/mcp/sandbox.js.map +1 -1
  97. package/dist/mcp/sdk-adapter.d.ts +478 -56
  98. package/dist/mcp/sdk-adapter.d.ts.map +1 -1
  99. package/dist/mcp/sdk-adapter.js +346 -44
  100. package/dist/mcp/sdk-adapter.js.map +1 -1
  101. package/dist/mcp/tools.d.ts +445 -30
  102. package/dist/mcp/tools.d.ts.map +1 -1
  103. package/dist/mcp/tools.js +363 -33
  104. package/dist/mcp/tools.js.map +1 -1
  105. package/dist/ops/blame.d.ts +424 -21
  106. package/dist/ops/blame.d.ts.map +1 -1
  107. package/dist/ops/blame.js +303 -20
  108. package/dist/ops/blame.js.map +1 -1
  109. package/dist/ops/branch.d.ts +583 -32
  110. package/dist/ops/branch.d.ts.map +1 -1
  111. package/dist/ops/branch.js +365 -23
  112. package/dist/ops/branch.js.map +1 -1
  113. package/dist/ops/commit-traversal.d.ts +164 -24
  114. package/dist/ops/commit-traversal.d.ts.map +1 -1
  115. package/dist/ops/commit-traversal.js +68 -2
  116. package/dist/ops/commit-traversal.js.map +1 -1
  117. package/dist/ops/commit.d.ts +387 -53
  118. package/dist/ops/commit.d.ts.map +1 -1
  119. package/dist/ops/commit.js +249 -29
  120. package/dist/ops/commit.js.map +1 -1
  121. package/dist/ops/merge-base.d.ts +195 -21
  122. package/dist/ops/merge-base.d.ts.map +1 -1
  123. package/dist/ops/merge-base.js +122 -12
  124. package/dist/ops/merge-base.js.map +1 -1
  125. package/dist/ops/merge.d.ts +600 -130
  126. package/dist/ops/merge.d.ts.map +1 -1
  127. package/dist/ops/merge.js +408 -60
  128. package/dist/ops/merge.js.map +1 -1
  129. package/dist/ops/tag.d.ts +67 -2
  130. package/dist/ops/tag.d.ts.map +1 -1
  131. package/dist/ops/tag.js +42 -1
  132. package/dist/ops/tag.js.map +1 -1
  133. package/dist/ops/tree-builder.d.ts +102 -6
  134. package/dist/ops/tree-builder.d.ts.map +1 -1
  135. package/dist/ops/tree-builder.js +30 -5
  136. package/dist/ops/tree-builder.js.map +1 -1
  137. package/dist/ops/tree-diff.d.ts +50 -2
  138. package/dist/ops/tree-diff.d.ts.map +1 -1
  139. package/dist/ops/tree-diff.js +50 -2
  140. package/dist/ops/tree-diff.js.map +1 -1
  141. package/dist/pack/delta.d.ts +211 -39
  142. package/dist/pack/delta.d.ts.map +1 -1
  143. package/dist/pack/delta.js +232 -46
  144. package/dist/pack/delta.js.map +1 -1
  145. package/dist/pack/format.d.ts +390 -28
  146. package/dist/pack/format.d.ts.map +1 -1
  147. package/dist/pack/format.js +344 -33
  148. package/dist/pack/format.js.map +1 -1
  149. package/dist/pack/full-generation.d.ts +313 -28
  150. package/dist/pack/full-generation.d.ts.map +1 -1
  151. package/dist/pack/full-generation.js +238 -19
  152. package/dist/pack/full-generation.js.map +1 -1
  153. package/dist/pack/generation.d.ts +346 -23
  154. package/dist/pack/generation.d.ts.map +1 -1
  155. package/dist/pack/generation.js +269 -21
  156. package/dist/pack/generation.js.map +1 -1
  157. package/dist/pack/index.d.ts +407 -86
  158. package/dist/pack/index.d.ts.map +1 -1
  159. package/dist/pack/index.js +351 -70
  160. package/dist/pack/index.js.map +1 -1
  161. package/dist/refs/branch.d.ts +517 -71
  162. package/dist/refs/branch.d.ts.map +1 -1
  163. package/dist/refs/branch.js +410 -26
  164. package/dist/refs/branch.js.map +1 -1
  165. package/dist/refs/storage.d.ts +610 -57
  166. package/dist/refs/storage.d.ts.map +1 -1
  167. package/dist/refs/storage.js +481 -29
  168. package/dist/refs/storage.js.map +1 -1
  169. package/dist/refs/tag.d.ts +677 -67
  170. package/dist/refs/tag.d.ts.map +1 -1
  171. package/dist/refs/tag.js +497 -30
  172. package/dist/refs/tag.js.map +1 -1
  173. package/dist/storage/lru-cache.d.ts +556 -53
  174. package/dist/storage/lru-cache.d.ts.map +1 -1
  175. package/dist/storage/lru-cache.js +439 -36
  176. package/dist/storage/lru-cache.js.map +1 -1
  177. package/dist/storage/object-index.d.ts +483 -38
  178. package/dist/storage/object-index.d.ts.map +1 -1
  179. package/dist/storage/object-index.js +388 -22
  180. package/dist/storage/object-index.js.map +1 -1
  181. package/dist/storage/r2-pack.d.ts +957 -94
  182. package/dist/storage/r2-pack.d.ts.map +1 -1
  183. package/dist/storage/r2-pack.js +756 -48
  184. package/dist/storage/r2-pack.js.map +1 -1
  185. package/dist/tiered/cdc-pipeline.d.ts +1610 -38
  186. package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
  187. package/dist/tiered/cdc-pipeline.js +1131 -22
  188. package/dist/tiered/cdc-pipeline.js.map +1 -1
  189. package/dist/tiered/migration.d.ts +903 -41
  190. package/dist/tiered/migration.d.ts.map +1 -1
  191. package/dist/tiered/migration.js +646 -24
  192. package/dist/tiered/migration.js.map +1 -1
  193. package/dist/tiered/parquet-writer.d.ts +944 -47
  194. package/dist/tiered/parquet-writer.d.ts.map +1 -1
  195. package/dist/tiered/parquet-writer.js +667 -39
  196. package/dist/tiered/parquet-writer.js.map +1 -1
  197. package/dist/tiered/read-path.d.ts +728 -34
  198. package/dist/tiered/read-path.d.ts.map +1 -1
  199. package/dist/tiered/read-path.js +310 -27
  200. package/dist/tiered/read-path.js.map +1 -1
  201. package/dist/types/objects.d.ts +457 -0
  202. package/dist/types/objects.d.ts.map +1 -1
  203. package/dist/types/objects.js +305 -4
  204. package/dist/types/objects.js.map +1 -1
  205. package/dist/types/storage.d.ts +407 -35
  206. package/dist/types/storage.d.ts.map +1 -1
  207. package/dist/types/storage.js +27 -3
  208. package/dist/types/storage.js.map +1 -1
  209. package/dist/utils/hash.d.ts +133 -12
  210. package/dist/utils/hash.d.ts.map +1 -1
  211. package/dist/utils/hash.js +133 -12
  212. package/dist/utils/hash.js.map +1 -1
  213. package/dist/utils/sha1.d.ts +102 -9
  214. package/dist/utils/sha1.d.ts.map +1 -1
  215. package/dist/utils/sha1.js +114 -11
  216. package/dist/utils/sha1.js.map +1 -1
  217. package/dist/wire/capabilities.d.ts +896 -88
  218. package/dist/wire/capabilities.d.ts.map +1 -1
  219. package/dist/wire/capabilities.js +566 -62
  220. package/dist/wire/capabilities.js.map +1 -1
  221. package/dist/wire/pkt-line.d.ts +293 -15
  222. package/dist/wire/pkt-line.d.ts.map +1 -1
  223. package/dist/wire/pkt-line.js +251 -15
  224. package/dist/wire/pkt-line.js.map +1 -1
  225. package/dist/wire/receive-pack.d.ts +814 -64
  226. package/dist/wire/receive-pack.d.ts.map +1 -1
  227. package/dist/wire/receive-pack.js +542 -41
  228. package/dist/wire/receive-pack.js.map +1 -1
  229. package/dist/wire/smart-http.d.ts +575 -97
  230. package/dist/wire/smart-http.d.ts.map +1 -1
  231. package/dist/wire/smart-http.js +337 -46
  232. package/dist/wire/smart-http.js.map +1 -1
  233. package/dist/wire/upload-pack.d.ts +492 -98
  234. package/dist/wire/upload-pack.d.ts.map +1 -1
  235. package/dist/wire/upload-pack.js +347 -59
  236. package/dist/wire/upload-pack.js.map +1 -1
  237. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"lru-cache.d.ts","sourceRoot":"","sources":["../../src/storage/lru-cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qDAAqD;IACrD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,CAAA;IACxC,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,cAAc,KAAK,IAAI,CAAA;CACnE;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,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AAgB,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CA4CzD"}
@@ -1,9 +1,106 @@
1
1
  /**
2
- * LRU Cache implementation for hot objects in gitdo
3
- * gitdo-165: LRU cache for hot objects
2
+ * @fileoverview LRU Cache Implementation for Hot Objects
3
+ *
4
+ * This module provides a high-performance Least Recently Used (LRU) cache
5
+ * implementation optimized for storing frequently accessed Git objects.
6
+ *
7
+ * ## Features
8
+ *
9
+ * - **Dual Limits**: Supports both count-based and byte-size-based limits
10
+ * - **TTL Support**: Optional time-to-live for automatic entry expiration
11
+ * - **Eviction Callbacks**: Hook into eviction events for cleanup or analytics
12
+ * - **Statistics Tracking**: Built-in hit/miss tracking and hit rate calculation
13
+ * - **O(1) Operations**: All get/set/delete operations are O(1) using a doubly linked list
14
+ *
15
+ * ## Implementation Details
16
+ *
17
+ * The cache uses a combination of:
18
+ * - A Map for O(1) key lookup
19
+ * - A doubly linked list for O(1) LRU ordering
20
+ *
21
+ * When the cache exceeds its limits, the least recently used items are evicted.
22
+ * Items can also be evicted due to TTL expiration.
23
+ *
24
+ * @module storage/lru-cache
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * // Create a cache with 100 items max and 10MB size limit
29
+ * const cache = new LRUCache<string, Uint8Array>({
30
+ * maxCount: 100,
31
+ * maxBytes: 10 * 1024 * 1024,
32
+ * defaultTTL: 3600000, // 1 hour
33
+ * onEvict: (key, value, reason) => {
34
+ * console.log(`Evicted ${key}: ${reason}`);
35
+ * }
36
+ * });
37
+ *
38
+ * // Store and retrieve values
39
+ * cache.set('object-sha', objectData);
40
+ * const data = cache.get('object-sha');
41
+ *
42
+ * // Check statistics
43
+ * const stats = cache.getStats();
44
+ * console.log(`Hit rate: ${stats.hitRate}%`);
45
+ * ```
4
46
  */
5
47
  /**
6
- * LRU Cache class for storing hot objects with size and count limits
48
+ * LRU Cache class for storing hot objects with size and count limits.
49
+ *
50
+ * @description
51
+ * A high-performance Least Recently Used cache with the following features:
52
+ *
53
+ * - **O(1) Operations**: Get, set, and delete are all constant time
54
+ * - **Dual Limits**: Supports both count and byte-size limits
55
+ * - **TTL Support**: Optional per-entry or default time-to-live
56
+ * - **Eviction Events**: Callbacks when items are removed
57
+ * - **Statistics**: Track hits, misses, and evictions
58
+ *
59
+ * The cache maintains items in order of recent use. When the cache is full,
60
+ * the least recently used items are evicted first.
61
+ *
62
+ * ## Type Parameters
63
+ *
64
+ * - `K`: The type of cache keys (default: string)
65
+ * - `V`: The type of cached values (default: unknown)
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * // Basic usage with string keys and Uint8Array values
70
+ * const objectCache = new LRUCache<string, Uint8Array>({
71
+ * maxCount: 1000,
72
+ * maxBytes: 100 * 1024 * 1024 // 100MB
73
+ * });
74
+ *
75
+ * // Store a value
76
+ * objectCache.set(sha, objectData);
77
+ *
78
+ * // Retrieve a value (returns undefined if not found or expired)
79
+ * const data = objectCache.get(sha);
80
+ *
81
+ * // Check without affecting LRU order
82
+ * if (objectCache.has(sha)) {
83
+ * const peeked = objectCache.peek(sha);
84
+ * }
85
+ *
86
+ * // Remove expired entries
87
+ * const pruned = objectCache.prune();
88
+ * console.log(`Removed ${pruned} expired entries`);
89
+ * ```
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * // With eviction callback for cleanup
94
+ * const cache = new LRUCache<string, Resource>({
95
+ * maxCount: 100,
96
+ * onEvict: (key, value, reason) => {
97
+ * if (reason !== 'clear') {
98
+ * value.dispose(); // Clean up resources
99
+ * }
100
+ * console.log(`Evicted ${key}: ${reason}`);
101
+ * }
102
+ * });
103
+ * ```
7
104
  */
8
105
  export class LRUCache {
9
106
  cache = new Map();
@@ -19,8 +116,31 @@ export class LRUCache {
19
116
  sizeCalculator;
20
117
  onEvict;
21
118
  /**
22
- * Create a new LRU cache
23
- * @param options Configuration options
119
+ * Creates a new LRU cache instance.
120
+ *
121
+ * @description
122
+ * Initializes the cache with the specified options. All options have
123
+ * sensible defaults for unlimited caching.
124
+ *
125
+ * @param options - Configuration options for the cache
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * // Simple cache with count limit
130
+ * const cache = new LRUCache({ maxCount: 100 });
131
+ *
132
+ * // Cache with size limit and TTL
133
+ * const cache = new LRUCache({
134
+ * maxBytes: 50 * 1024 * 1024, // 50MB
135
+ * defaultTTL: 3600000 // 1 hour
136
+ * });
137
+ *
138
+ * // Cache with custom size calculator for Uint8Array
139
+ * const binaryCache = new LRUCache<string, Uint8Array>({
140
+ * maxBytes: 100 * 1024 * 1024,
141
+ * sizeCalculator: (arr) => arr.byteLength
142
+ * });
143
+ * ```
24
144
  */
25
145
  constructor(options) {
26
146
  this.maxCount = options?.maxCount ?? Infinity;
@@ -30,7 +150,12 @@ export class LRUCache {
30
150
  this.onEvict = options?.onEvict;
31
151
  }
32
152
  /**
33
- * Check if an entry is expired
153
+ * Checks if an entry is expired.
154
+ *
155
+ * @param entry - The cache entry to check
156
+ * @returns true if the entry has expired
157
+ *
158
+ * @internal
34
159
  */
35
160
  isExpired(entry) {
36
161
  if (entry.expiresAt === null)
@@ -38,7 +163,11 @@ export class LRUCache {
38
163
  return Date.now() > entry.expiresAt;
39
164
  }
40
165
  /**
41
- * Move a node to the head (most recently used)
166
+ * Moves a node to the head (most recently used position).
167
+ *
168
+ * @param node - The node to move
169
+ *
170
+ * @internal
42
171
  */
43
172
  moveToHead(node) {
44
173
  if (node === this.head)
@@ -57,7 +186,11 @@ export class LRUCache {
57
186
  }
58
187
  }
59
188
  /**
60
- * Remove a node from the linked list
189
+ * Removes a node from the linked list.
190
+ *
191
+ * @param node - The node to remove
192
+ *
193
+ * @internal
61
194
  */
62
195
  removeNode(node) {
63
196
  if (node.prev) {
@@ -74,7 +207,11 @@ export class LRUCache {
74
207
  }
75
208
  }
76
209
  /**
77
- * Add a node to the head of the list
210
+ * Adds a node to the head of the list.
211
+ *
212
+ * @param node - The node to add
213
+ *
214
+ * @internal
78
215
  */
79
216
  addToHead(node) {
80
217
  node.prev = null;
@@ -88,7 +225,11 @@ export class LRUCache {
88
225
  }
89
226
  }
90
227
  /**
91
- * Evict items until we're under limits
228
+ * Evicts items until the cache can accommodate a new item.
229
+ *
230
+ * @param requiredSize - Size in bytes needed for the new item
231
+ *
232
+ * @internal
92
233
  */
93
234
  evictToFit(requiredSize) {
94
235
  // Evict until we have room for the new item
@@ -105,9 +246,25 @@ export class LRUCache {
105
246
  }
106
247
  }
107
248
  /**
108
- * Get a value from the cache
109
- * @param key The cache key
249
+ * Gets a value from the cache.
250
+ *
251
+ * @description
252
+ * Retrieves a value by key. If the key exists and hasn't expired,
253
+ * returns the value and moves the entry to the most recently used position.
254
+ * If the key doesn't exist or has expired, returns undefined.
255
+ *
256
+ * @param key - The cache key to look up
257
+ *
110
258
  * @returns The cached value or undefined if not found/expired
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * const cache = new LRUCache<string, string>();
263
+ * cache.set('greeting', 'hello');
264
+ *
265
+ * const value = cache.get('greeting'); // 'hello'
266
+ * const missing = cache.get('nonexistent'); // undefined
267
+ * ```
111
268
  */
112
269
  get(key) {
113
270
  const node = this.cache.get(key);
@@ -133,11 +290,40 @@ export class LRUCache {
133
290
  return node.entry.value;
134
291
  }
135
292
  /**
136
- * Set a value in the cache
137
- * @param key The cache key
138
- * @param value The value to cache
139
- * @param options Optional settings for this entry
140
- * @returns true if successfully set, false otherwise
293
+ * Sets a value in the cache.
294
+ *
295
+ * @description
296
+ * Stores a value with the given key. If the key already exists,
297
+ * updates the value. If storing the value would exceed limits,
298
+ * evicts least recently used items first.
299
+ *
300
+ * Returns false if the value is larger than maxBytes (cannot fit).
301
+ *
302
+ * @param key - The cache key
303
+ * @param value - The value to cache
304
+ * @param options - Optional per-entry settings (TTL, size)
305
+ *
306
+ * @returns true if successfully stored, false if value too large
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * const cache = new LRUCache<string, Uint8Array>({
311
+ * maxBytes: 1024
312
+ * });
313
+ *
314
+ * // Basic set
315
+ * cache.set('key1', new Uint8Array([1, 2, 3]));
316
+ *
317
+ * // Set with custom TTL
318
+ * cache.set('key2', data, { ttl: 60000 }); // 1 minute
319
+ *
320
+ * // Set with explicit size
321
+ * cache.set('key3', complexObject, { size: 1000 });
322
+ *
323
+ * // Returns false if value too large
324
+ * const hugeData = new Uint8Array(10000);
325
+ * cache.set('huge', hugeData); // returns false
326
+ * ```
141
327
  */
142
328
  set(key, value, options) {
143
329
  const size = options?.size ?? this.sizeCalculator(value);
@@ -186,9 +372,23 @@ export class LRUCache {
186
372
  return true;
187
373
  }
188
374
  /**
189
- * Check if a key exists in the cache (without updating LRU order)
190
- * @param key The cache key
375
+ * Checks if a key exists in the cache.
376
+ *
377
+ * @description
378
+ * Returns true if the key exists and hasn't expired.
379
+ * Does NOT update LRU order (use peek() for that too).
380
+ *
381
+ * @param key - The cache key to check
382
+ *
191
383
  * @returns true if the key exists and is not expired
384
+ *
385
+ * @example
386
+ * ```typescript
387
+ * if (cache.has('important-key')) {
388
+ * // Key exists and is valid
389
+ * const value = cache.get('important-key');
390
+ * }
391
+ * ```
192
392
  */
193
393
  has(key) {
194
394
  const node = this.cache.get(key);
@@ -199,9 +399,22 @@ export class LRUCache {
199
399
  return true;
200
400
  }
201
401
  /**
202
- * Delete a key from the cache
203
- * @param key The cache key
402
+ * Deletes a key from the cache.
403
+ *
404
+ * @description
405
+ * Removes an entry from the cache. Triggers the onEvict callback
406
+ * with reason 'manual'.
407
+ *
408
+ * @param key - The cache key to delete
409
+ *
204
410
  * @returns true if the key was deleted, false if it didn't exist
411
+ *
412
+ * @example
413
+ * ```typescript
414
+ * cache.set('key', 'value');
415
+ * cache.delete('key'); // returns true
416
+ * cache.delete('key'); // returns false (already deleted)
417
+ * ```
205
418
  */
206
419
  delete(key) {
207
420
  const node = this.cache.get(key);
@@ -216,7 +429,21 @@ export class LRUCache {
216
429
  return true;
217
430
  }
218
431
  /**
219
- * Clear all entries from the cache
432
+ * Clears all entries from the cache.
433
+ *
434
+ * @description
435
+ * Removes all entries and resets the byte counter. If an onEvict
436
+ * callback is configured, it's called for each entry with reason 'clear'.
437
+ *
438
+ * Does NOT reset statistics (use resetStats() for that).
439
+ *
440
+ * @example
441
+ * ```typescript
442
+ * cache.set('a', 1);
443
+ * cache.set('b', 2);
444
+ * cache.clear();
445
+ * console.log(cache.size); // 0
446
+ * ```
220
447
  */
221
448
  clear() {
222
449
  if (this.onEvict) {
@@ -231,8 +458,21 @@ export class LRUCache {
231
458
  this._bytes = 0;
232
459
  }
233
460
  /**
234
- * Get cache statistics
461
+ * Gets cache statistics.
462
+ *
463
+ * @description
464
+ * Returns current statistics about cache performance including
465
+ * hits, misses, item count, byte usage, evictions, and hit rate.
466
+ *
235
467
  * @returns Current cache statistics
468
+ *
469
+ * @example
470
+ * ```typescript
471
+ * const stats = cache.getStats();
472
+ * console.log(`Hit rate: ${stats.hitRate}%`);
473
+ * console.log(`Cache size: ${stats.count} items, ${stats.bytes} bytes`);
474
+ * console.log(`Evictions: ${stats.evictions}`);
475
+ * ```
236
476
  */
237
477
  getStats() {
238
478
  const total = this._hits + this._misses;
@@ -247,7 +487,18 @@ export class LRUCache {
247
487
  };
248
488
  }
249
489
  /**
250
- * Reset cache statistics (keeps cached data)
490
+ * Resets cache statistics.
491
+ *
492
+ * @description
493
+ * Resets hit, miss, and eviction counters to zero.
494
+ * Does NOT clear cached data.
495
+ *
496
+ * @example
497
+ * ```typescript
498
+ * // After warmup period, reset stats
499
+ * cache.resetStats();
500
+ * // Now stats reflect production traffic
501
+ * ```
251
502
  */
252
503
  resetStats() {
253
504
  this._hits = 0;
@@ -255,19 +506,47 @@ export class LRUCache {
255
506
  this._evictions = 0;
256
507
  }
257
508
  /**
258
- * Get the number of items currently in the cache
509
+ * Gets the number of items currently in the cache.
510
+ *
511
+ * @returns Current item count
512
+ *
513
+ * @example
514
+ * ```typescript
515
+ * console.log(`Cache has ${cache.size} items`);
516
+ * ```
259
517
  */
260
518
  get size() {
261
519
  return this.cache.size;
262
520
  }
263
521
  /**
264
- * Get the current byte size of the cache
522
+ * Gets the current byte size of the cache.
523
+ *
524
+ * @returns Current size in bytes
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * console.log(`Cache using ${cache.bytes} bytes`);
529
+ * ```
265
530
  */
266
531
  get bytes() {
267
532
  return this._bytes;
268
533
  }
269
534
  /**
270
- * Get all keys in the cache (in LRU order, most recent first)
535
+ * Gets all keys in the cache in LRU order.
536
+ *
537
+ * @description
538
+ * Returns keys from most recently used to least recently used.
539
+ * Does NOT affect LRU ordering.
540
+ *
541
+ * @returns Array of keys in LRU order (most recent first)
542
+ *
543
+ * @example
544
+ * ```typescript
545
+ * cache.set('a', 1);
546
+ * cache.set('b', 2);
547
+ * cache.get('a');
548
+ * console.log(cache.keys()); // ['a', 'b']
549
+ * ```
271
550
  */
272
551
  keys() {
273
552
  const keys = [];
@@ -279,7 +558,18 @@ export class LRUCache {
279
558
  return keys;
280
559
  }
281
560
  /**
282
- * Get all values in the cache (in LRU order, most recent first)
561
+ * Gets all values in the cache in LRU order.
562
+ *
563
+ * @description
564
+ * Returns values from most recently used to least recently used.
565
+ * Does NOT affect LRU ordering.
566
+ *
567
+ * @returns Array of values in LRU order (most recent first)
568
+ *
569
+ * @example
570
+ * ```typescript
571
+ * const recentValues = cache.values();
572
+ * ```
283
573
  */
284
574
  values() {
285
575
  const values = [];
@@ -291,7 +581,20 @@ export class LRUCache {
291
581
  return values;
292
582
  }
293
583
  /**
294
- * Get all entries in the cache (in LRU order, most recent first)
584
+ * Gets all entries in the cache in LRU order.
585
+ *
586
+ * @description
587
+ * Returns [key, value] pairs from most recently used to least recently used.
588
+ * Does NOT affect LRU ordering.
589
+ *
590
+ * @returns Array of [key, value] pairs in LRU order
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * for (const [key, value] of cache.entries()) {
595
+ * console.log(`${key}: ${value}`);
596
+ * }
597
+ * ```
295
598
  */
296
599
  entries() {
297
600
  const entries = [];
@@ -303,9 +606,22 @@ export class LRUCache {
303
606
  return entries;
304
607
  }
305
608
  /**
306
- * Peek at a value without updating LRU order
307
- * @param key The cache key
609
+ * Peeks at a value without updating LRU order.
610
+ *
611
+ * @description
612
+ * Retrieves a value without marking it as recently used.
613
+ * Useful for inspection or when you don't want to affect eviction order.
614
+ *
615
+ * @param key - The cache key to peek at
616
+ *
308
617
  * @returns The cached value or undefined if not found/expired
618
+ *
619
+ * @example
620
+ * ```typescript
621
+ * // Check value without affecting LRU order
622
+ * const value = cache.peek('key');
623
+ * // This won't prevent 'key' from being evicted next
624
+ * ```
309
625
  */
310
626
  peek(key) {
311
627
  const node = this.cache.get(key);
@@ -316,8 +632,27 @@ export class LRUCache {
316
632
  return node.entry.value;
317
633
  }
318
634
  /**
319
- * Evict expired entries from the cache
635
+ * Evicts expired entries from the cache.
636
+ *
637
+ * @description
638
+ * Scans all entries and removes those that have expired.
639
+ * Triggers onEvict callback with reason 'ttl' for each removed entry.
640
+ *
641
+ * Call this periodically if you need proactive cleanup of expired entries.
642
+ * Note: Expired entries are also cleaned up lazily on get().
643
+ *
320
644
  * @returns Number of entries evicted
645
+ *
646
+ * @example
647
+ * ```typescript
648
+ * // Run periodic cleanup
649
+ * setInterval(() => {
650
+ * const pruned = cache.prune();
651
+ * if (pruned > 0) {
652
+ * console.log(`Pruned ${pruned} expired entries`);
653
+ * }
654
+ * }, 60000); // Every minute
655
+ * ```
321
656
  */
322
657
  prune() {
323
658
  let pruned = 0;
@@ -336,8 +671,22 @@ export class LRUCache {
336
671
  return pruned;
337
672
  }
338
673
  /**
339
- * Resize the cache to new limits
340
- * @param options New size limits
674
+ * Resizes the cache to new limits.
675
+ *
676
+ * @description
677
+ * Updates the maxCount and/or maxBytes limits. If the current cache
678
+ * exceeds the new limits, evicts LRU items until within limits.
679
+ *
680
+ * @param options - New size limits (maxCount and/or maxBytes)
681
+ *
682
+ * @example
683
+ * ```typescript
684
+ * // Reduce cache size under memory pressure
685
+ * cache.resize({ maxBytes: 10 * 1024 * 1024 }); // Reduce to 10MB
686
+ *
687
+ * // Increase limit when more memory is available
688
+ * cache.resize({ maxCount: 1000, maxBytes: 100 * 1024 * 1024 });
689
+ * ```
341
690
  */
342
691
  resize(options) {
343
692
  if (options.maxCount !== undefined) {
@@ -361,13 +710,67 @@ export class LRUCache {
361
710
  }
362
711
  }
363
712
  /**
364
- * Create a key serializer for complex key types
713
+ * Creates a key serializer for complex key types.
714
+ *
715
+ * @description
716
+ * Helper function for creating serializers when using complex key types
717
+ * that need to be converted to/from strings.
718
+ *
719
+ * @param serialize - Function to convert key to string
720
+ * @param deserialize - Function to convert string back to key
721
+ *
722
+ * @returns Object with serialize and deserialize functions
723
+ *
724
+ * @example
725
+ * ```typescript
726
+ * interface ObjectKey {
727
+ * repo: string;
728
+ * sha: string;
729
+ * }
730
+ *
731
+ * const keySerializer = createKeySerializer<ObjectKey>(
732
+ * (key) => `${key.repo}:${key.sha}`,
733
+ * (str) => {
734
+ * const [repo, sha] = str.split(':');
735
+ * return { repo, sha };
736
+ * }
737
+ * );
738
+ *
739
+ * // Use with cache
740
+ * const serializedKey = keySerializer.serialize({ repo: 'foo', sha: 'abc' });
741
+ * cache.set(serializedKey, value);
742
+ * ```
365
743
  */
366
744
  export function createKeySerializer(serialize, deserialize) {
367
745
  return { serialize, deserialize };
368
746
  }
369
747
  /**
370
- * Default size calculator for common value types
748
+ * Default size calculator for common value types.
749
+ *
750
+ * @description
751
+ * Estimates the byte size of common JavaScript value types:
752
+ * - `null/undefined`: 0 bytes
753
+ * - `string`: 2 bytes per character (UTF-16)
754
+ * - `number`: 8 bytes
755
+ * - `boolean`: 4 bytes
756
+ * - `Uint8Array/ArrayBuffer`: actual byteLength
757
+ * - `object`: JSON-serialized length * 2
758
+ * - `unknown`: 8 bytes (default)
759
+ *
760
+ * For more accurate size calculation with specific types,
761
+ * provide a custom sizeCalculator in CacheOptions.
762
+ *
763
+ * @param value - The value to calculate size for
764
+ *
765
+ * @returns Estimated size in bytes
766
+ *
767
+ * @example
768
+ * ```typescript
769
+ * defaultSizeCalculator('hello'); // 10 (5 chars * 2)
770
+ * defaultSizeCalculator(42); // 8
771
+ * defaultSizeCalculator(new Uint8Array(100)); // 100
772
+ * defaultSizeCalculator({ key: 'value' }); // ~30
773
+ * ```
371
774
  */
372
775
  export function defaultSizeCalculator(value) {
373
776
  if (value === null || value === undefined) {