3.2.0 • Published 4 months ago

graphql-hooks-memcache v3.2.0

Weekly downloads
1,978
License
Apache-2.0
Repository
github
Last release
4 months ago

graphql-hooks-memcache

In-memory caching implementation for graphql-hooks

Install

npm install graphql-hooks-memcache

or

yarn add graphql-hooks-memcache

Quick Start

This is intended to be used as the cache option when calling createClient from graphql-hooks.

import { GraphQLClient } from 'graphql-hooks'
import memCache from 'graphql-hooks-memcache'

const client = new GraphQLClient({
  url: '/graphql',
  cache: memCache()
})

Options

memCache(options): Option object properties

  • size: The number of items to store in the cache
  • ttl: Milliseconds an item will remain in cache. The default behaviour will only evict items when the size limit has been reached
  • initialState: The value from cache.getInitialState() used for rehydrating the cache after SSR

API

  • cache.get(key): Find the item in the cache that matches key
  • cache.set(key, value): Set an item in the cache
  • cache.delete(key): Delete an item from the cache
  • cache.clear(): Clear all items from the cache
  • cache.keys(): Returns an array of keys, useful when you need to iterate over the cache items
  • cache.getInitialState(): A serialisable version of the cache - used during SSR
3.2.0

4 months ago

3.1.3

10 months ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.1

1 year ago

3.0.0

2 years ago

2.3.0

2 years ago

2.3.1

2 years ago

2.2.4

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago