# @types/memory-cache

> TypeScript definitions for memory-cache

Latest version **0.2.6** (published 2024-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/memory-cache
pnpm add @types/memory-cache
yarn add @types/memory-cache
bun add @types/memory-cache
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2024-07-29 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/memory-cache
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/memory-cache
- npm.io page: https://npm.io/package/@types/memory-cache

## Recent versions

- 0.2.6 (latest) — 2024-07-29
- 0.2.5 (ts4.5) — 2023-11-07
- 0.2.3 (ts4.3) — 2023-06-15
- 0.2.2 (ts4.1) — 2022-02-02
- 0.2.1 (ts3.1) — 2020-03-02
- 0.2.0 (ts2.2) — 2017-10-17
- 0.2.4 — 2023-10-18
- 0.0.31 — 2017-08-21
- 0.0.30 — 2017-08-14
- 0.0.29 — 2016-09-19
- 0.0.28 — 2016-07-14
- 0.0.27-alpha — 2016-07-08
- 0.0.26-alpha — 2016-07-04
- 0.0.25-alpha — 2016-07-02
- 0.0.24-alpha — 2016-07-01
- … 5 more at https://npm.io/package/@types/memory-cache/versions

## README

# Installation
> `npm install --save @types/memory-cache`

# Summary
This package contains type definitions for memory-cache (https://github.com/ptarjan/node-cache).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/memory-cache.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/memory-cache/index.d.ts)
````ts
// Originally imported from: https://github.com/soywiz/typescript-node-definitions/memory-cache.d.ts

export class CacheClass<K, V> {
    put(key: K, value: V, time?: number, timeoutCallback?: (key: K, value: V) => void): V;
    get(key: K): V | null;
    del(key: K): boolean;
    clear(): void;

    size(): number;
    memsize(): number;

    debug(bool: boolean): void;
    hits(): number;
    misses(): number;
    keys(): K[];

    /**
     * @returns The new size of the cache
     * @see {@link https://github.com/ptarjan/node-cache#importjson--functionjson-string-options--skipduplicates-boolean-}
     */
    importJson(json: string, options?: { skipDuplicates?: boolean | undefined }): number;
    /**
     * @returns A JSON string representing all the cache data
     */
    exportJson(): string;
}

export const Cache: typeof CacheClass;

export function put<V>(key: any, value: V, time?: number, timeoutCallback?: (key: any, value: any) => void): V;
export function get(key: any): any;
export function del(key: any): boolean;
export function clear(): void;

export function size(): number;
export function memsize(): number;

export function debug(bool: boolean): void;
export function hits(): number;
export function misses(): number;
export function keys(): any[];

/**
 * @returns The new size of the cache
 * @see {@link https://github.com/ptarjan/node-cache#importjson--functionjson-string-options--skipduplicates-boolean-}
 */
export function importJson(json: string, options?: { skipDuplicates?: boolean | undefined }): number;
/**
 * @returns A JSON string representing all the cache data
 */
export function exportJson(): string;

````

### Additional Details
 * Last updated: Mon, 29 Jul 2024 19:36:25 GMT
 * Dependencies: none

# Credits
These definitions were written by [Travis Thieman](https://github.com/thieman).

---
_Source: https://npm.io/package/@types/memory-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
