@contentful-tools/store
An auto-synchronizing in-memory store for Contentful content
Last updated 8 months ago by leobh .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @contentful-tools/store 
SYNC missed versions from official npm registry.

Contentful Store

Version License Dependencies Dev Dependencies Dependabot Status

npm install @contentful-tools/store

Use in conjunction with: Contentful Tools CLI (npm)

The store caches content in-memory, and can be accessed synchronously in microseconds. It can be set up to synchronize whenever content is accessed, throttled to a configurable minimum interval. This uses the sync endpoint of the Contentful Content Delivery API, which returns the entries and assets that have been added and deleted since the last sync — to efficiently keep content always up-to-date.

Your content can be linked however you like, even circularly. Assets and entries are stored by ID, and links are transparently resolved on the fly, using getter properties. This meshes nicely with a GraphQL API, and allows blazingly fast queries of arbitrary depth. Fields resolve to the value for the requested locale first, but use the base locale’s value as a fallback.

Note, the first fetch after a period of no requests will potentially return stale content, since the store synchronously responds before triggering the sync. If your server is under any appreciable load however, this won’t be a problem. You are at least guaranteed to get back content in a consistent state — you’ll never get partially-synced content.

Also note, this probably won’t work very well in serverless environments, unless you’re doing something to keep your function containers alive between invocations. Otherwise, there’s a fairly high startup cost to pay in order to run the initial sync with Contentful (of course, dependent on the size of your content space).

Current Tags

  • 0.7.3                                ...           latest (8 months ago)

10 Versions

  • 0.7.3                                ...           8 months ago
  • 0.7.0                                ...           9 months ago
  • 0.6.0                                ...           9 months ago
  • 0.5.0                                ...           9 months ago
  • 0.4.0                                ...           9 months ago
  • 0.3.0                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |