Comparing version 4.0.0-canary.8 to 4.0.0
{ | ||
"name": "cachu", | ||
"version": "4.0.0-canary.8", | ||
"version": "4.0.0", | ||
"description": "🦝 Simple, Minimalistic KV Cache", | ||
"types": "./types/node.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./types/node.d.ts", | ||
"import": "./build/node.js", | ||
"require": "./build/node.cjs" | ||
}, | ||
"./browser": { | ||
"types": "./types/browser.d.ts", | ||
"import": "./build/browser.js", | ||
"require": "./build/browser.cjs" | ||
} | ||
}, | ||
"types": "./types/index.d.ts", | ||
"exports": "./build/index.js", | ||
"scripts": { | ||
"dev": "tsc -w", | ||
"build": "packu --node --esm -i src/node.ts -o build/node.js && packu --node -i src/node.ts -o build/node.cjs", | ||
"build:browser": "packu --node --esm -i src/browser.ts -o build/browser.js && packu --node -i src/browser.ts -o build/browser.cjs", | ||
"types": "tsc -w", | ||
"build": "packu --node --esm -i src/index.ts -o build/index.js", | ||
"publish:patch": "tsc && npm run build && npm version patch && npm publish", | ||
@@ -41,3 +29,3 @@ "publish:minor": "tsc && npm run build && npm version minor && npm publish", | ||
"async", | ||
"modular" | ||
"modules" | ||
], | ||
@@ -44,0 +32,0 @@ "author": "Azury <hello@azury.dev> (https://azury.dev)", |
@@ -51,3 +51,3 @@ # cachu | ||
- [`maxAmount`](https://github.com/azurydev/cachu/blob/current/guide/configuration/maxAmount.md) to set the **maximum size** for the cache | ||
- [`overrideEntries`](https://github.com/azurydev/cachu/blob/current/guide/configuration/overrideEntries.md) to allow overriding of entries on reading | ||
- [`overriding`](https://github.com/azurydev/cachu/blob/current/guide/configuration/overriding.md) to allow overriding of entries on reading | ||
- [`hooks`](https://github.com/azurydev/cachu/blob/current/guide/configuration/hooks.md) to extend **cachu**'s functionality | ||
@@ -74,1 +74,12 @@ | ||
- [`getKeysOfEntries()`](https://github.com/azurydev/cachu/blob/current/guide/features/getKeysOfEntries.md) | ||
- ### Hooks | ||
- [`preWriting`](https://github.com/azurydev/cachu/blob/current/guide/hooks/preWriting.md) | ||
- [`preReading`](https://github.com/azurydev/cachu/blob/current/guide/hooks/preReading.md) | ||
- [`preGrabbing`](https://github.com/azurydev/cachu/blob/current/guide/hooks/preGrabbing.md) | ||
- [`preUpdating`](https://github.com/azurydev/cachu/blob/current/guide/hooks/preUpdating.md) | ||
- [`preStealing`](https://github.com/azurydev/cachu/blob/current/guide/hooks/preStealing.md) | ||
- [`prePurging`](https://github.com/azurydev/cachu/blob/current/guide/hooks/prePurging.md) | ||
- [`prePruning`](https://github.com/azurydev/cachu/blob/current/guide/hooks/prePruning.md) | ||
@@ -1,2 +0,2 @@ | ||
import { Hooks, Key, Value, KeyValue } from '../types'; | ||
import { Hooks, Entry } from '../types'; | ||
interface Configuration { | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
overrideEntries?: boolean; | ||
overriding?: boolean; | ||
} | ||
@@ -24,3 +24,3 @@ export default class MemoryCache { | ||
private maxAmount; | ||
private overrideEntries; | ||
private overriding; | ||
private hooks; | ||
@@ -41,3 +41,3 @@ private store; | ||
*/ | ||
write: (key: Key, value: Value) => Promise<void>; | ||
write: (key: any, value: any) => Promise<void>; | ||
/** | ||
@@ -48,3 +48,3 @@ * Create many new entries in the cache. | ||
*/ | ||
writeMany: (entries: KeyValue[]) => Promise<void>; | ||
writeMany: (entries: Entry[]) => Promise<void>; | ||
/** | ||
@@ -55,3 +55,3 @@ * Read an entry from the cache. | ||
*/ | ||
get: (key: Key) => Promise<any>; | ||
get: (key: any) => Promise<any>; | ||
/** | ||
@@ -62,3 +62,3 @@ * Read many entries from the cache. | ||
*/ | ||
getMany: (keys: Key[]) => Promise<any[]>; | ||
getMany: (keys: any[]) => Promise<any[]>; | ||
/** | ||
@@ -69,3 +69,3 @@ * Grab an entry from the cache. | ||
*/ | ||
grab: (key: Key) => Promise<any>; | ||
grab: (key: any) => Promise<any>; | ||
/** | ||
@@ -76,3 +76,3 @@ * Grab many entries from the cache. | ||
*/ | ||
grabMany: (keys: Key[]) => Promise<any[]>; | ||
grabMany: (keys: any[]) => Promise<any[]>; | ||
/** | ||
@@ -83,3 +83,3 @@ * Steal an entry from the cache. | ||
*/ | ||
steal: (key: Key) => Promise<any>; | ||
steal: (key: any) => Promise<any>; | ||
/** | ||
@@ -90,3 +90,3 @@ * Steal many entries from the cache. | ||
*/ | ||
stealMany: (keys: Key[]) => Promise<any[]>; | ||
stealMany: (keys: any[]) => Promise<any[]>; | ||
/** | ||
@@ -97,3 +97,3 @@ * Modify an entry in the cache. | ||
*/ | ||
update: (key: Key, value: Value) => Promise<void>; | ||
update: (key: any, value: any) => Promise<void>; | ||
/** | ||
@@ -104,3 +104,3 @@ * Modify many entries in the cache. | ||
*/ | ||
updateMany: (entries: KeyValue[]) => Promise<void>; | ||
updateMany: (entries: Entry[]) => Promise<void>; | ||
/** | ||
@@ -111,3 +111,3 @@ * Purge an entry from the cache. | ||
*/ | ||
purge: (key: Key) => Promise<void>; | ||
purge: (key: any) => Promise<void>; | ||
/** | ||
@@ -118,3 +118,3 @@ * Purge many or all entries from the cache. | ||
*/ | ||
purgeMany: (keys: Key[]) => Promise<void>; | ||
purgeMany: (keys: any[]) => Promise<void>; | ||
/** | ||
@@ -125,3 +125,3 @@ * Check whether the cache has a specific entry. | ||
*/ | ||
has: (key: Key) => Promise<boolean>; | ||
has: (key: any) => Promise<boolean>; | ||
/** | ||
@@ -136,3 +136,3 @@ * Get the number of entries the cache holds. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getKeysOfEntries.md) | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getanysOfEntries.md) | ||
*/ | ||
@@ -143,3 +143,3 @@ getKeysOfEntries: () => Promise<any[]>; | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getValuesOfEntries.md) | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getanysOfEntries.md) | ||
*/ | ||
@@ -146,0 +146,0 @@ getValuesOfEntries: () => Promise<any[]>; |
@@ -1,2 +0,1 @@ | ||
import { Key, Value } from '../types'; | ||
interface Configuration { | ||
@@ -14,13 +13,13 @@ /** | ||
*/ | ||
overrideEntries?: boolean; | ||
overriding?: boolean; | ||
} | ||
export default class MemoryCache { | ||
export default class MiniCache { | ||
private maxAge; | ||
private maxAmount; | ||
private overrideEntries; | ||
private overriding; | ||
private store; | ||
/** | ||
* Create a new `MemoryCache`. | ||
* Create a new `MiniCache`. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/caches/MemoryCache.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/caches/MiniCache.md) | ||
*/ | ||
@@ -33,45 +32,45 @@ constructor(config?: Configuration); | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/write.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/write.md) | ||
*/ | ||
write: (key: Key, value: Value) => Promise<void>; | ||
write: (key: any, value: any) => Promise<void>; | ||
/** | ||
* Read an entry from the cache. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/get.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/get.md) | ||
*/ | ||
get: (key: Key) => Promise<any>; | ||
get: (key: any) => Promise<any>; | ||
/** | ||
* Grab an entry from the cache. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/grab.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/grab.md) | ||
*/ | ||
grab: (key: Key) => Promise<any>; | ||
grab: (key: any) => Promise<any>; | ||
/** | ||
* Steal an entry from the cache. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/steal.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/steal.md) | ||
*/ | ||
steal: (key: Key) => Promise<any>; | ||
steal: (key: any) => Promise<any>; | ||
/** | ||
* Modify an entry in the cache. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/update.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/update.md) | ||
*/ | ||
update: (key: Key, value: Value) => Promise<void>; | ||
update: (key: any, value: any) => Promise<void>; | ||
/** | ||
* Purge an entry from the cache. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/purge.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/purge.md) | ||
*/ | ||
purge: (key: Key) => Promise<void>; | ||
purge: (key: any) => Promise<void>; | ||
/** | ||
* Check whether the cache has a specific entry. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/has.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/has.md) | ||
*/ | ||
has: (key: Key) => Promise<boolean>; | ||
has: (key: any) => Promise<boolean>; | ||
/** | ||
* Purge all stale entries manually. | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/prune.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/prune.md) | ||
*/ | ||
@@ -82,3 +81,3 @@ prune: () => Promise<void>; | ||
* | ||
* [📖 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getConsumedMemory.md) | ||
* [📒 Read the Guide](https://github.com/azurydev/cachu/blob/current/guide/features/getConsumedMemory.md) | ||
*/ | ||
@@ -85,0 +84,0 @@ getConsumedMemory: () => Promise<number>; |
@@ -6,4 +6,4 @@ export interface Hooks { | ||
preWriting?: ({ entry }: { | ||
entry: Entry; | ||
}) => Promise<Entry | null>; | ||
entry: RawEntry; | ||
}) => Promise<RawEntry | null>; | ||
/** | ||
@@ -13,9 +13,9 @@ * A function getting fired before getting an entry from the cache. | ||
preReading?: ({ keyOfTargetedEntry }: { | ||
keyOfTargetedEntry: Key; | ||
keyOfTargetedEntry: any; | ||
}) => Promise<boolean>; | ||
/** | ||
* A function getting fired before getting an entry from the cache. | ||
* A function getting fired before grabbing an entry from the cache. | ||
*/ | ||
preGrabbing?: ({ keyOfTargetedEntry }: { | ||
keyOfTargetedEntry: Key; | ||
keyOfTargetedEntry: any; | ||
}) => Promise<boolean>; | ||
@@ -26,3 +26,3 @@ /** | ||
preUpdating?: ({ keyOfTargetedEntry }: { | ||
keyOfTargetedEntry: Key; | ||
keyOfTargetedEntry: any; | ||
}) => Promise<boolean>; | ||
@@ -33,3 +33,3 @@ /** | ||
preStealing?: ({ keyOfTargetedEntry }: { | ||
keyOfTargetedEntry: Key; | ||
keyOfTargetedEntry: any; | ||
}) => Promise<boolean>; | ||
@@ -40,3 +40,3 @@ /** | ||
prePurging?: ({ keyOfTargetedEntry }: { | ||
keyOfTargetedEntry: Key; | ||
keyOfTargetedEntry: any; | ||
}) => Promise<boolean>; | ||
@@ -47,15 +47,13 @@ /** | ||
prePruning?: ({ entries }: { | ||
entries: Entry[]; | ||
entries: RawEntry[]; | ||
}) => Promise<boolean>; | ||
} | ||
export declare type Key = any; | ||
export declare type Value = any; | ||
export interface Entry { | ||
key: Key; | ||
value: Value; | ||
export interface RawEntry { | ||
key: any; | ||
value: any; | ||
createdAt: number; | ||
} | ||
export interface KeyValue { | ||
key: Key; | ||
value: Value; | ||
export interface Entry { | ||
key: any; | ||
value: any; | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
42667
10
0
84
281