qznt 2.0.1 → 2.1.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/README.md CHANGED
@@ -55,6 +55,7 @@ import { Cache, Storage } from "qznt";
55
55
  // Cache with a 1-minute global TTL
56
56
  const userCache = new Cache<UserData>(60000);
57
57
  userCache.set("user_1", data);
58
+ userCache.delete("user_1");
58
59
 
59
60
  // Persistent storage (Browser or NodeJS based)
60
61
  const settings = new Storage("app_settings");
package/dist/index.cjs CHANGED
@@ -128,6 +128,14 @@ var Cache = class {
128
128
  }
129
129
  return data.value;
130
130
  }
131
+ /**
132
+ * Removes a single entry from the cache.
133
+ * @param key The key to remove
134
+ * @returns Whether an entry existed and was removed
135
+ */
136
+ delete(key) {
137
+ return this.cache.delete(key);
138
+ }
131
139
  cleanup() {
132
140
  if (this.cache.size === 0) return;
133
141
  const now = Date.now();
package/dist/index.d.cts CHANGED
@@ -9,6 +9,12 @@ declare class Cache<T> {
9
9
  constructor(cleanupMs?: number);
10
10
  set(key: string | number, value: T, ttlMs?: number): void;
11
11
  get(key: string | number): T | null;
12
+ /**
13
+ * Removes a single entry from the cache.
14
+ * @param key The key to remove
15
+ * @returns Whether an entry existed and was removed
16
+ */
17
+ delete(key: string | number): boolean;
12
18
  private cleanup;
13
19
  clear(): void;
14
20
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,12 @@ declare class Cache<T> {
9
9
  constructor(cleanupMs?: number);
10
10
  set(key: string | number, value: T, ttlMs?: number): void;
11
11
  get(key: string | number): T | null;
12
+ /**
13
+ * Removes a single entry from the cache.
14
+ * @param key The key to remove
15
+ * @returns Whether an entry existed and was removed
16
+ */
17
+ delete(key: string | number): boolean;
12
18
  private cleanup;
13
19
  clear(): void;
14
20
  }
package/dist/index.js CHANGED
@@ -28,6 +28,14 @@ var Cache = class {
28
28
  }
29
29
  return data.value;
30
30
  }
31
+ /**
32
+ * Removes a single entry from the cache.
33
+ * @param key The key to remove
34
+ * @returns Whether an entry existed and was removed
35
+ */
36
+ delete(key) {
37
+ return this.cache.delete(key);
38
+ }
31
39
  cleanup() {
32
40
  if (this.cache.size === 0) return;
33
41
  const now = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qznt",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "description": "A lightweight typed utility toolkit for modern TypeScript environments.",
5
5
  "license": "MIT",
6
6
  "author": "xsqu1znt",