Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@types/node-cache

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/node-cache - npm Package Compare versions

Comparing version
3.0.27
to
3.0.28
+262
node-cache/index.d.ts
// Type definitions for node-cache v3.0.0
// Project: https://github.com/tcs-de/nodecache
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace NodeCache {
interface NodeCache {
/** container for cached data */
data: Data;
/** module options */
options: Options;
/** statistics container */
stats: Stats;
/**
* get a cached key and change the stats
*
* @param key cache key or an array of keys
* @param cb Callback function
*/
get<T>(
key: string,
cb?: Callback<T>
): T;
/**
* get multiple cached keys at once and change the stats
*
* @param keys an array of keys
* @param cb Callback function
*/
mget<T>(
keys: string[],
cb?: Callback<{[key: string]: T}>
): {[key: string]: T};
/**
* set a cached key and change the stats
*
* @param key cache key
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
* it to a serialized JSON
* @param ttl The time to live in seconds.
* @param cb Callback function
*/
set<T>(
key: string,
value: T,
ttl: number|string,
cb?: Callback<boolean>
): boolean;
set<T>(
key: string,
value: T,
cb?: Callback<boolean>
): boolean;
/**
* remove keys
* @param keys cache key to delete or a array of cache keys
* @param cb Callback function
* @returns Number of deleted keys
*/
del(
keys: string|string[],
cb?: Callback<number>
): number;
/**
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
*/
ttl(
key: string,
ttl: number,
cb?: Callback<boolean>
): boolean;
ttl(
key: string,
cb?: Callback<boolean>,
ttl?: number
): boolean;
/**
* list all keys within this cache
* @param cb Callback function
* @returns An array of all keys
*/
keys(cb?: Callback<string[]>): string[];
/**
* get the stats
*
* @returns Stats data
*/
getStats(): Stats;
/**
* flush the hole data and reset the stats
*/
flushAll(): void;
/**
* This will clear the interval timeout which is set on checkperiod option.
*/
close(): void;
}
interface Data {
[key: string]: WrappedValue<any>;
}
interface Options {
forceString?: boolean;
objectValueSize?: number;
arrayValueSize?: number;
stdTTL?: number;
checkperiod?: number;
useClones?: boolean;
}
interface Stats {
hits: number;
misses: number;
keys: number;
ksize: number;
vsize: number;
}
interface WrappedValue<T> {
// ttl
t: number;
// value
v: T;
}
interface Callback<T> {
(err: any, data: T): void;
}
}
import events = require("events");
import Data = NodeCache.Data;
import Options = NodeCache.Options;
import Stats = NodeCache.Stats;
import Callback = NodeCache.Callback;
declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCache {
/** container for cached data */
data: Data;
/** module options */
options: Options;
/** statistics container */
stats: Stats;
constructor(options?: Options);
/**
* get a cached key and change the stats
*
* @param key cache key or an array of keys
* @param cb Callback function
*/
get<T>(
key: string,
cb?: Callback<T>
): T;
/**
* get multiple cached keys at once and change the stats
*
* @param keys an array of keys
* @param cb Callback function
*/
mget<T>(
keys: string[],
cb?: Callback<{[key: string]: T}>
): {[key: string]: T};
/**
* set a cached key and change the stats
*
* @param key cache key
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
* it to a serialized JSON
* @param ttl The time to live in seconds.
* @param cb Callback function
*/
set<T>(
key: string,
value: T,
ttl: number|string,
cb?: Callback<boolean>
): boolean;
set<T>(
key: string,
value: T,
cb?: Callback<boolean>
): boolean;
/**
* remove keys
* @param keys cache key to delete or a array of cache keys
* @param cb Callback function
* @returns Number of deleted keys
*/
del(
keys: string|string[],
cb?: Callback<number>
): number;
/**
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
*/
ttl(
key: string,
ttl: number,
cb?: Callback<boolean>
): boolean;
ttl(
key: string,
cb?: Callback<boolean>,
ttl?: number
): boolean;
/**
* list all keys within this cache
* @param cb Callback function
* @returns An array of all keys
*/
keys(cb?: Callback<string[]>): string[];
/**
* get the stats
*
* @returns Stats data
*/
getStats(): Stats;
/**
* flush the hole data and reset the stats
*/
flushAll(): void;
/**
* This will clear the interval timeout which is set on checkperiod option.
*/
close(): void;
}
export = NodeCache;
{
"name": "@types/node-cache",
"version": "3.0.28",
"description": "TypeScript definitions for node-cache v3.0.0",
"license": "MIT",
"author": "Ilya Mochalov <https://github.com/chrootsu>",
"main": "",
"repository": {
"type": "git",
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"dependencies": {
"@types/node": "6.0.*"
},
"typings": "index.d.ts"
}
# Installation
> `npm install --save @types/node-cache`
# Summary
This package contains type definitions for node-cache v3.0.0 (https://github.com/tcs-de/nodecache).
# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/node-cache
Additional Details
* Last updated: Thu, 18 Aug 2016 13:50:58 GMT
* File structure: ProperModule
* Library Dependencies: node
* Module Dependencies: events
* Global values: NodeCache
# Credits
These definitions were written by Ilya Mochalov <https://github.com/chrootsu>.
{
"authors": "Ilya Mochalov <https://github.com/chrootsu>",
"definitionFilename": "index.d.ts",
"libraryDependencies": [
"node"
],
"moduleDependencies": [
"events"
],
"libraryMajorVersion": "3",
"libraryMinorVersion": "0",
"libraryName": "node-cache v3.0.0",
"typingsPackageName": "node-cache",
"projectName": "https://github.com/tcs-de/nodecache",
"sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
"sourceBranch": "types-2.0",
"kind": "ProperModule",
"globals": [
"NodeCache"
],
"declaredModules": [
"node-cache"
],
"files": [
"index.d.ts"
],
"hasPackageJson": false,
"contentHash": "fa7900d71bfc049d5792de8c16e5bfb1ac48efd00788e082a6113a8de6fbb52a"
}
-262
// Type definitions for node-cache v3.0.0
// Project: https://github.com/tcs-de/nodecache
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace NodeCache {
interface NodeCache {
/** container for cached data */
data: Data;
/** module options */
options: Options;
/** statistics container */
stats: Stats;
/**
* get a cached key and change the stats
*
* @param key cache key or an array of keys
* @param cb Callback function
*/
get<T>(
key: string,
cb?: Callback<T>
): T;
/**
* get multiple cached keys at once and change the stats
*
* @param keys an array of keys
* @param cb Callback function
*/
mget<T>(
keys: string[],
cb?: Callback<{[key: string]: T}>
): {[key: string]: T};
/**
* set a cached key and change the stats
*
* @param key cache key
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
* it to a serialized JSON
* @param ttl The time to live in seconds.
* @param cb Callback function
*/
set<T>(
key: string,
value: T,
ttl: number|string,
cb?: Callback<boolean>
): boolean;
set<T>(
key: string,
value: T,
cb?: Callback<boolean>
): boolean;
/**
* remove keys
* @param keys cache key to delete or a array of cache keys
* @param cb Callback function
* @returns Number of deleted keys
*/
del(
keys: string|string[],
cb?: Callback<number>
): number;
/**
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
*/
ttl(
key: string,
ttl: number,
cb?: Callback<boolean>
): boolean;
ttl(
key: string,
cb?: Callback<boolean>,
ttl?: number
): boolean;
/**
* list all keys within this cache
* @param cb Callback function
* @returns An array of all keys
*/
keys(cb?: Callback<string[]>): string[];
/**
* get the stats
*
* @returns Stats data
*/
getStats(): Stats;
/**
* flush the hole data and reset the stats
*/
flushAll(): void;
/**
* This will clear the interval timeout which is set on checkperiod option.
*/
close(): void;
}
interface Data {
[key: string]: WrappedValue<any>;
}
interface Options {
forceString: boolean;
objectValueSize: number;
arrayValueSize: number;
stdTTL: number;
checkperiod: number;
useClones: boolean;
}
interface Stats {
hits: number;
misses: number;
keys: number;
ksize: number;
vsize: number;
}
interface WrappedValue<T> {
// ttl
t: number;
// value
v: T;
}
interface Callback<T> {
(err: any, data: T): void;
}
}
import events = require("events");
import Data = NodeCache.Data;
import Options = NodeCache.Options;
import Stats = NodeCache.Stats;
import Callback = NodeCache.Callback;
declare class NodeCache extends events.EventEmitter implements NodeCache.NodeCache {
/** container for cached data */
data: Data;
/** module options */
options: Options;
/** statistics container */
stats: Stats;
constructor(options?: Options);
/**
* get a cached key and change the stats
*
* @param key cache key or an array of keys
* @param cb Callback function
*/
get<T>(
key: string,
cb?: Callback<T>
): T;
/**
* get multiple cached keys at once and change the stats
*
* @param keys an array of keys
* @param cb Callback function
*/
mget<T>(
keys: string[],
cb?: Callback<{[key: string]: T}>
): {[key: string]: T};
/**
* set a cached key and change the stats
*
* @param key cache key
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
* it to a serialized JSON
* @param ttl The time to live in seconds.
* @param cb Callback function
*/
set<T>(
key: string,
value: T,
ttl: number|string,
cb?: Callback<boolean>
): boolean;
set<T>(
key: string,
value: T,
cb?: Callback<boolean>
): boolean;
/**
* remove keys
* @param keys cache key to delete or a array of cache keys
* @param cb Callback function
* @returns Number of deleted keys
*/
del(
keys: string|string[],
cb?: Callback<number>
): number;
/**
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
*/
ttl(
key: string,
ttl: number,
cb?: Callback<boolean>
): boolean;
ttl(
key: string,
cb?: Callback<boolean>,
ttl?: number
): boolean;
/**
* list all keys within this cache
* @param cb Callback function
* @returns An array of all keys
*/
keys(cb?: Callback<string[]>): string[];
/**
* get the stats
*
* @returns Stats data
*/
getStats(): Stats;
/**
* flush the hole data and reset the stats
*/
flushAll(): void;
/**
* This will clear the interval timeout which is set on checkperiod option.
*/
close(): void;
}
export = NodeCache;
{
"name": "@types/node-cache",
"version": "3.0.27",
"description": "TypeScript definitions for node-cache v3.0.0",
"main": "",
"scripts": {},
"author": "Ilya Mochalov <https://github.com/chrootsu>",
"repository": {
"type": "git",
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"license": "MIT",
"typings": "index.d.ts",
"dependencies": {
"@types/node": "4.0.*"
}
}
# Installation
> `npm install --save @types/node-cache`
# Summary
This package contains type definitions for node-cache v3.0.0 (https://github.com/tcs-de/nodecache).
# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/node-cache
Additional Details
* Last updated: Thu, 14 Jul 2016 13:52:47 GMT
* File structure: ProperModule
* Library Dependencies: node
* Module Dependencies: events
* Global values: NodeCache
# Credits
These definitions were written by Ilya Mochalov <https://github.com/chrootsu>.
{
"authors": "Ilya Mochalov <https://github.com/chrootsu>",
"definitionFilename": "index.d.ts",
"libraryDependencies": [
"node"
],
"moduleDependencies": [
"events"
],
"libraryMajorVersion": "3",
"libraryMinorVersion": "0",
"libraryName": "node-cache v3.0.0",
"typingsPackageName": "node-cache",
"projectName": "https://github.com/tcs-de/nodecache",
"sourceRepoURL": "https://www.github.com/DefinitelyTyped/DefinitelyTyped",
"sourceBranch": "types-2.0",
"kind": "ProperModule",
"globals": [
"NodeCache"
],
"declaredModules": [
"node-cache"
],
"files": [
"index.d.ts"
],
"contentHash": "df32c1d6593919e60241f95d5fc45ee3048bb088ab5f43418c26040c2d494b34"
}