Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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
The npm package apollo-link-local-cache receives a total of 0 weekly downloads. As such, apollo-link-local-cache popularity was classified as not popular.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.