Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cacheable

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

41

dist/index.d.ts

@@ -49,2 +49,13 @@ import { KeyvStoreAdapter, StoredData, Keyv } from 'keyv';

type CacheableItem = {
key: string;
value: any;
ttl?: number | string;
};
type CacheableStoreItem = {
key: string;
value: any;
expires?: number;
};
type CacheableMemoryOptions = {

@@ -56,7 +67,2 @@ ttl?: number | string;

};
type CacheableItem$1 = {
key: string;
value: any;
expires?: number;
};
declare class CacheableMemory {

@@ -91,9 +97,14 @@ private readonly _hashCache;

get keys(): IterableIterator<string>;
get items(): IterableIterator<CacheableItem$1>;
get items(): IterableIterator<CacheableStoreItem>;
get<T>(key: string): any;
getRaw(key: string): CacheableItem$1 | undefined;
getMany<T>(keys: string[]): any[];
getRaw(key: string): CacheableStoreItem | undefined;
getManyRaw(keys: string[]): Array<CacheableStoreItem | undefined>;
set(key: string, value: any, ttl?: number | string): void;
setMany(items: CacheableItem[]): void;
has(key: string): boolean;
take<T>(key: string): any;
takeMany<T>(keys: string[]): any[];
delete(key: string): void;
deleteMany(keys: string[]): void;
clear(): void;

@@ -120,8 +131,13 @@ hashKey(key: string): number;

get<Value>(key: string): Promise<StoredData<Value> | undefined>;
set(key: string, value: any, ttl?: number): void;
getMany<Value>(keys: string[]): Promise<Array<StoredData<Value | undefined>>>;
set(key: string, value: any, ttl?: number): Promise<void>;
setMany(values: Array<{
key: string;
value: any;
ttl?: number;
}>): Promise<void>;
delete(key: string): Promise<boolean>;
deleteMany?(key: string[]): Promise<boolean>;
clear(): Promise<void>;
has?(key: string): Promise<boolean>;
getMany?<Value>(keys: string[]): Promise<Array<StoredData<Value | undefined>>>;
deleteMany?(key: string[]): Promise<boolean>;
on(event: string, listener: (...arguments_: any[]) => void): this;

@@ -146,7 +162,2 @@ }

}
type CacheableItem = {
key: string;
value: unknown;
ttl?: number | string;
};
type CacheableOptions = {

@@ -153,0 +164,0 @@ primary?: Keyv | KeyvStoreAdapter;

@@ -234,2 +234,9 @@ // src/index.ts

}
getMany(keys) {
const result = new Array();
for (const key of keys) {
result.push(this.get(key));
}
return result;
}
getRaw(key) {

@@ -248,2 +255,9 @@ const store = this.getStore(key);

}
getManyRaw(keys) {
const result = new Array();
for (const key of keys) {
result.push(this.getRaw(key));
}
return result;
}
set(key, value, ttl) {

@@ -279,2 +293,7 @@ const store = this.getStore(key);

}
setMany(items) {
for (const item of items) {
this.set(item.key, item.value, item.ttl);
}
}
has(key) {

@@ -292,2 +311,9 @@ const item = this.get(key);

}
takeMany(keys) {
const result = new Array();
for (const key of keys) {
result.push(this.take(key));
}
return result;
}
delete(key) {

@@ -297,2 +323,7 @@ const store = this.getStore(key);

}
deleteMany(keys) {
for (const key of keys) {
this.delete(key);
}
}
clear() {

@@ -460,5 +491,12 @@ this._hash0.clear();

}
set(key, value, ttl) {
async getMany(keys) {
const result = this._cache.getMany(keys);
return result;
}
async set(key, value, ttl) {
this._cache.set(key, value, ttl);
}
async setMany(values) {
this._cache.setMany(values);
}
async delete(key) {

@@ -468,2 +506,6 @@ this._cache.delete(key);

}
async deleteMany(key) {
this._cache.deleteMany(key);
return true;
}
async clear() {

@@ -475,15 +517,2 @@ this._cache.clear();

}
async getMany(keys) {
const result = [];
for (const key of keys) {
result.push(this._cache.get(key));
}
return result;
}
async deleteMany(key) {
for (const k of key) {
this._cache.delete(k);
}
return true;
}
on(event, listener) {

@@ -490,0 +519,0 @@ return this;

{
"name": "cacheable",
"version": "1.7.0",
"version": "1.7.1",
"description": "Simple Caching Engine using Keyv",

@@ -5,0 +5,0 @@ "type": "module",

@@ -264,9 +264,16 @@ [<img align="center" src="https://cacheable.org/logo.svg" alt="Cacheable" />](https://github.com/jaredwray/cacheable)

* `set(key, value, ttl?)`: Sets a value in the cache.
* `setMany([{key, value, ttl?}])`: Sets multiple values in the cache from `CachableItem`.
* `get(key)`: Gets a value from the cache.
* `getMany([keys])`: Gets multiple values from the cache.
* `getRaw(key)`: Gets a value from the cache as `CacheableStoreItem`.
* `getManyRaw([keys])`: Gets multiple values from the cache as `CacheableStoreItem`.
* `has(key)`: Checks if a value exists in the cache.
* `delete(key)`: Deletes a value from the cache.
* `deleteMany([keys])`: Deletes multiple values from the cache.
* `take(key)`: Takes a value from the cache and deletes it.
* `takeMany([keys])`: Takes multiple values from the cache and deletes them.
* `clear()`: Clears the cache.
* `size()`: The number of keys in the cache.
* `keys()`: The keys in the cache.
* `items()`: The items in the cache as `{ key, value, expires? }`.
* `items()`: The items in the cache as `CacheableStoreItem` example `{ key, value, expires? }`.
* `checkExpired()`: Checks for expired keys in the cache. This is used by the `checkInterval` property.

@@ -273,0 +280,0 @@ * `startIntervalCheck()`: Starts the interval check for expired keys if `checkInterval` is above 0 ms.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc