Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-cache-persist

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-cache-persist - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2-beta.0

bundle.umd.js

45

package.json
{
"name": "apollo-cache-persist",
"version": "0.0.1",
"version": "0.0.2-beta.0",
"description": "Simple persistence for all Apollo cache implementations",
"author": "James Reggio <james.reggio@gmail.com>",
"contributors": [
"James Reggio <james.reggio@gmail.com>",
"Peggy Rayzis <peggy@meteor.com>"
],
"license": "MIT",
"main": "apollo-cache-persist.umd.js",
"module": "index.js",
"jsnext:main": "index.js",
"typings": "index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/jamesreggio/apollo-cache-persist.git"
"url": "git+https://github.com/apollographql/apollo-cache-persist.git"
},
"homepage": "https://github.com/jamesreggio/apollo-cache-persist",
"bugs": "https://github.com/jamesreggio/apollo-cache-persist/issues",
"main": "src/index.js"
}
"homepage": "https://github.com/apollographql/apollo-cache-persist#readme",
"bugs": "https://github.com/apollographql/apollo-cache-persist/issues",
"dependencies": {},
"devDependencies": {
"@types/node": "^8.0.55",
"@types/react-native": "^0.50.8",
"apollo-cache": "^1.0.2",
"apollo-cache-hermes": "^0.4.55-alpha",
"apollo-cache-inmemory": "^1.1.3",
"apollo-client": "^2.1.0",
"apollo-link": "^1.0.5",
"browserify": "^14.5.0",
"bundlesize": "^0.15.3",
"codecov": "^3.0.0",
"danger": "^2.1.3",
"graphql": "^0.11.7",
"graphql-tag": "^2.5.0",
"husky": "^0.14.3",
"jest": "^21.2.1",
"lint-staged": "^6.0.0",
"prettier": "^1.8.2",
"rimraf": "^2.6.2",
"rollup": "^0.52.1",
"ts-jest": "^21.2.4",
"typescript": "^2.6.2",
"uglify-js": "^3.2.2"
},
"browser": "apollo-cache-persist.browser.umd.js"
}

42

README.md
# apollo-cache-persist
__NOTE: This repo is in 'pre-release' and not quite ready to production use yet.__
**NOTE: This repo is in 'pre-release' and not quite ready to production use
yet.**
Simple persistence for all Apollo Cache 2.0+ implementations, including [`apollo-cache-inmemory`][0] and [`apollo-cache-hermes`][1].
Simple persistence for all Apollo Cache 2.0+ implementations, including
[`apollo-cache-inmemory`][0] and [`apollo-cache-hermes`][1].

@@ -14,5 +16,8 @@ Supports web and React Native. [See all storage providers.](#storage-providers)

To get started, simply pass your Apollo Cache and an [underlying storage provider](#storage-providers) to `persistCache`.
To get started, simply pass your Apollo Cache and an
[underlying storage provider](#storage-providers) to `persistCache`.
By default, the contents of your Apollo Cache will be immediately restored (asynchronously), and will be persisted upon every write to the cache (with a short debounce interval).
By default, the contents of your Apollo Cache will be immediately restored
(asynchronously), and will be persisted upon every write to the cache (with a
short debounce interval).

@@ -56,3 +61,4 @@ ### Examples

`persistCache` and the constructor for `CachePersistor` accept the following options:
`persistCache` and the constructor for `CachePersistor` accept the following
options:

@@ -65,4 +71,4 @@ ```js

cache, // Reference to your Apollo Cache.
storage, // Reference to your storage provider.
cache, // Reference to your Apollo Cache.
storage, // Reference to your storage provider.

@@ -73,4 +79,4 @@ /**

trigger: 'write', // Persist upon every write to the store. Default.
trigger: 'background', // Persist when your app moves to the background. React Native only.
trigger: 'write', // Persist upon every write to the store. Default.
trigger: 'background', // Persist when your app moves to the background. React Native only.

@@ -95,5 +101,8 @@ // Debounce interval (in ms) between persists.

// Purges storage & pauses persistence if trigger causes cache size to pass a threshold (in bytes). App will start up cold.
maxSize?: number,
// Enable console logging.
debug: false,
})
});
```

@@ -103,5 +112,7 @@

Instead of using `persistCache`, you can instantiate a `CachePersistor`, which will give you fine-grained control of persistence.
Instead of using `persistCache`, you can instantiate a `CachePersistor`, which
will give you fine-grained control of persistence.
`CachePersistor` accepts the same options as `persistCache` and returns an object with the following methods:
`CachePersistor` accepts the same options as `persistCache` and returns an
object with the following methods:

@@ -132,3 +143,4 @@ ```js

The following storage providers work 'out of the box', with no additional dependencies:
The following storage providers work 'out of the box', with no additional
dependencies:

@@ -140,3 +152,5 @@ * `AsyncStorage` on React Native

`apollo-cache-persist` uses the same storage provider API as [`redux-persist`][2], so you can also make use of the providers [listed here][3], including:
`apollo-cache-persist` uses the same storage provider API as
[`redux-persist`](https://github.com/rt2zz/redux-persist), so you can also make
use of the providers [listed here](#storage-providers), including:

@@ -143,0 +157,0 @@ * [`redux-persist-node-storage`](https://github.com/pellejacobs/redux-persist-node-storage)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc