@nxtedition/lib 23.5.7 → 23.5.8

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 (2) hide show
  1. package/cache.js +2 -9
  2. package/package.json +1 -1
package/cache.js CHANGED
@@ -2,7 +2,6 @@ import { LRUCache } from 'lru-cache'
2
2
 
3
3
  export class AsyncCache {
4
4
  #lru
5
- #prefix
6
5
  #valueSelector
7
6
  #keySelector
8
7
  #dedupe = new Map()
@@ -10,10 +9,10 @@ export class AsyncCache {
10
9
  #stale
11
10
 
12
11
  constructor(location, valueSelector, keySelector, opts) {
13
- this.#lru = new LRUCache({ max: 1024 })
12
+ this.#lru = new LRUCache({ max: 4096 })
14
13
 
15
14
  if (typeof location === 'string') {
16
- this.#prefix = location + ':'
15
+ // Do nothing...
17
16
  } else {
18
17
  throw new TypeError('location must be undefined or a string')
19
18
  }
@@ -58,11 +57,6 @@ export class AsyncCache {
58
57
 
59
58
  let cached = this.#lru.get(key)
60
59
 
61
- if (!cached) {
62
- const raw = globalThis.localStorage.getItem(this.#prefix + key)
63
- cached = raw ? JSON.parse(raw) : null
64
- }
65
-
66
60
  if (cached) {
67
61
  if (Date.now() < cached.expire) {
68
62
  return cached.value
@@ -108,7 +102,6 @@ export class AsyncCache {
108
102
  value,
109
103
  }
110
104
 
111
- globalThis.localStorage.setItem(this.#prefix + key, JSON.stringify(cached))
112
105
  this.#lru.set(key, cached)
113
106
  }
114
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "23.5.7",
3
+ "version": "23.5.8",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",