Morrys Repositories

Morrys Repositories

  • Docs
  • GitHub

›caching

wora

  • wora

caching

  • Cache Persist
  • Relay Store
  • Apollo Cache

networking

  • NetInfo
  • Detect Network

offline

  • Offline Architecture
  • Thinking Offline
  • Offline First
  • Relay Offline
  • Apollo Offline

Relay Store

@wora/relay-store

Overview

In this library the "RelayModernStore" has been extended and the "MutableRecordSource" relay-runtime interface has been implemented in order to add the following features:

  • Query persistence

  • Persistence of records associated with queries

  • Time To Live management of queries in the store

  • Define the condition to execute the garbage collector

add setCheckGC Method

allows you to define a custom condition to execute the garbage collector

add purge Method

allows you to purge the store

add hydrate Method

allows you to hydrate the store from storage

Installation

Install @wora/relay-store using yarn or npm:

yarn add @wora/relay-store

Examples

import { RecordSource, Store } from '@wora/relay-store';
import { CacheOptions } from "@wora/cache-persist";
import { Environment } from 'relay-runtime';

const defaultTTL: number = 10 * 60 * 1000; // optional, default
const persistOptionsRecords: CacheOptions = {}; // optional, default
const recordSource = new RecordSource(persistOptionsRecords);
const persistOptions: CacheOptions = { }; // optional, default
const store = new Store(recordSource, {}, { queryCacheExpirationTime: defaultTTL });
const environment = new Environment({network, store});

// ...

await store.hydrate();

Options

CacheOptions

Last updated on 2021-1-19 by morrys
← Cache PersistApollo Cache →
  • Overview
  • Installation
    • Examples
    • Options
Morrys Repositories
Docs
about wora
Community
User Showcase
More
GitHubStar
Follow @m0rrys
Facebook Open Source
Copyright © 2021 Lorenzo Di Giacomo