# @magnicache/client

> Client-side caching layer for GraphQL

Latest version **1.0.1** (published 2023-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @magnicache/client
pnpm add @magnicache/client
yarn add @magnicache/client
bun add @magnicache/client
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-03-15 |
| First published | 2023-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 50 |
| Author | MagniCache |
| Maintainers | achami64, trumanmiller, yousuf-e |
| Keywords | cache, caching, graphQL, client, clientside, client-side, lightweight, localstorage, magnicache, magniClient, query, performance, API, optimization, response time, scalability |

## Links

- npm: https://www.npmjs.com/package/@magnicache/client
- Repository: https://github.com/oslabs-beta/MagniCache
- Homepage: https://github.com/oslabs-beta/MagniCache#readme
- Issues: https://github.com/oslabs-beta/MagniCache/issues
- npm.io page: https://npm.io/package/@magnicache/client

## Dependencies (1)

- [lodash.mergewith](https://npm.io/package/lodash.mergewith.md) ^4.6.2

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-03-15
- 1.0.0 — 2023-03-13

## README

# Magnicache/client

<!-- @magnicache/client is a powerful library designed to significantly improve response times for GraphQL queries by leveraging the browser's localStorage. -->

A lightweight client-side GraphQL caching solution that optimizes queries by atomizing complex queries and caching them individually.
<br/>
MagniClient utilizes localStorage to cache query results across sessions.
<br>
Configurable cache size.

<br>

## How to use @magnicache/client in your GraphQL client

1. Install MagniCache Client.

```bash
npm i @magnicache/client
```

2. Import MagniCache Client.

```js
const MagniClient = require('@magnicache/client');
```

3. Declare a new instance of MagniClient, optionally passing in a cache capacity(defaults to 40).

```js
const magniClient = new MagniClient(maxSize);
```

4. Invoke magniClient.query, passing in the query string and the graphql endpoint.

```js
magniClient
  .query(
    `query {
    person(personID: 1) {
        name
        eyeColor
        height
    }
  }`,
    '/graphql'
  )
  .then((response) => {
    const queryData = response[0];
    const cacheStatus = response[1];
    // Handle the response data
  })
  .catch((err) => {
    // Handle errors
  });
```

## Contributors

[Ahmed Chami](https://www.linkedin.com/in/ahmed-chami/)

[Aria Soltankhah](https://www.linkedin.com/in/ariasol/)

[Truman Miller](https://www.linkedin.com/in/truman-miller)

[Yousuf Elkhoga](https://www.linkedin.com/in/yousufelkhoga/)

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