apollo-server-caching

  • Version 0.7.0
  • Published
  • 21 kB
  • 1 dependency
  • MIT license

Install

npm i apollo-server-caching
yarn add apollo-server-caching
pnpm add apollo-server-caching

Overview

[![npm version](https://badge.fury.io/js/apollo-server-caching.svg)](https://badge.fury.io/js/apollo-server-caching) [![Build Status](https://circleci.com/gh/apollographql/apollo-server/tree/main.svg?style=svg)](https://circleci.com/gh/apollographql/apoll

Index

Classes

class InMemoryLRUCache

class InMemoryLRUCache<V = string> implements TestableKeyValueCache<V> {}

    constructor

    constructor({
    maxSize,
    sizeCalculator,
    onDispose,
    }?: {
    maxSize?: number;
    sizeCalculator?: (value: V, key: string) => number;
    onDispose?: (key: string, value: V) => void;
    });

      method delete

      delete: (key: string) => Promise<void>;

        method flush

        flush: () => Promise<void>;

          method get

          get: (key: string) => Promise<V | undefined>;

            method getTotalSize

            getTotalSize: () => Promise<number>;

              method set

              set: (key: string, value: V, options?: { ttl?: number }) => Promise<void>;

                class PrefixingKeyValueCache

                class PrefixingKeyValueCache<V = string> implements KeyValueCache<V> {}

                  constructor

                  constructor(wrapped: KeyValueCache<V>, prefix: string);

                    method delete

                    delete: (key: string) => Promise<boolean | void>;

                      method get

                      get: (key: string) => Promise<V | undefined>;

                        method set

                        set: (key: string, value: V, options?: KeyValueCacheSetOptions) => Promise<void>;

                          Interfaces

                          interface KeyValueCache

                          interface KeyValueCache<V = string> {}

                            method delete

                            delete: (key: string) => Promise<boolean | void>;

                              method get

                              get: (key: string) => Promise<V | undefined>;

                                method set

                                set: (key: string, value: V, options?: KeyValueCacheSetOptions) => Promise<void>;

                                  interface KeyValueCacheSetOptions

                                  interface KeyValueCacheSetOptions {}

                                    property ttl

                                    ttl?: number | null;

                                      interface TestableKeyValueCache

                                      interface TestableKeyValueCache<V = string> extends KeyValueCache<V> {}

                                        method close

                                        close: () => Promise<void>;

                                          method flush

                                          flush: () => Promise<void>;

                                            Package Files (4)

                                            Dependencies (1)

                                            Dev Dependencies (0)

                                            No dev dependencies.

                                            Peer Dependencies (0)

                                            No peer dependencies.

                                            Badge

                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/apollo-server-caching.

                                            • Markdown
                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/apollo-server-caching)
                                            • HTML
                                              <a href="https://www.jsdocs.io/package/apollo-server-caching"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>