
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
apollo-link-local-cache
Advanced tools
Apollo Link that facilitates locally storing query results
An Apollo Link that facilitates locally storing query results via interception of responses.
yarn add apollo-link-local-cache
import { LocalCacheLink } from 'apollo-link-local-cache'
const link = new LocalCacheLink()
LocalCacheLink takes an object with the following options to allow customization of it's behavior:
name | value | default | required |
---|---|---|---|
shouldCache | boolean | Function | true |
generateKey | Function | operation.toKey | false |
storage | Object | Function | localStorage in the browser |
normalize | Function | JSON.stringify | false |
shouldCache
The cache policy. When set to true
defaults to cache all. When set to a callback, will receive the operation as argument, and should return true
or false
. Defaults to true
.
generateKey
A callback to generate a key for an operation. Defaults to using operation.toKey
.
storage
The Storage in use. Will default to window.localStorage when available. Can also be a callback, in which case it will be called with the current operation
and should retrieve a valid storage.
normalize
Normalization callback, which receives the operation
. Executed prior to storing a query result.
denormalize
Denormalization callback, which receives the operation
. Executed after retrieving a cached query result from the store.
hasLocalDirective
A special shouldCache
implementation is available for enabling caching of queries which use the @local
directive. Use it as follows:
import {
LocalCacheLink,
hasLocalDirective as shouldCache,
} from 'apollo-link-local-cache'
const link = new LocalCacheLink({ shouldCache })
The LocalCacheLink does not use the context for anything, but customization of the config options will often receive the full operation
, meaning they can achieve their purpose by using the context if necessary.
FAQs
Apollo Link that facilitates locally storing query results
We found that apollo-link-local-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.