1.3.0 • Published 2 years ago

@saltyaom/gql-local-cache v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@saltyaom/gql-local-cache

Local Storage Cache Plugin for @saltyaom/gql

Example Usage

import gql, { client } from '@saltyaom/gql'
import localCache from '@saltyaom/gql-local-cache'

client.config(
  'https://api.opener.studio/graphql', 
  {
    plugins: [localCache()]
  }
)

gql(
  `query GetHentaiById($id: Int!) {
    getHentaiById(id: $id) {
      success
      data {
        title {
          display
          japanese
        }
      }
    }
  }`,
  {
    variables: {
      id: 177013
    }
  }
).then((data) => {
  console.log(data)
})

Custom Config

You can pass custom config to localCache()

Available config:

  • ttl
    • How long should the cache live in seconds.
    • default: 86400 seconds (1 days)
1.2.0

2 years ago

1.1.1

2 years ago

1.1.9

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.3

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago