Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
apollo-cache-hermes
Advanced tools
Readme
An alternative cache implementation for Apollo Client, tuned for the performance of heavy GraphQL payloads.
This is very much a work in progress! It currently meets most of our needs internally, but is not yet a drop-in replacement for Apollo's default in memory cache. See the roadmap to get a sense of the work that's left.
This cache maintains an immutable & normalized graph of the values received from your GraphQL server. It enables the cache to return direct references to the cache, in order to satisfy queries1. As a result, reads from the cache require minimal work (and can be optimized to constant time lookups in some cases). The tradeoff is that rather than receiving only the fields selected by a GraphQL query, there may be additional fields.
This is in contrast to the built in cache for Apollo (and Relay), which maintain a normalized map of values. The unfortunate reality of those caches is that read operations impose considerable overhead (in CPU and memory) in order to build a result payload. See the motivation behind this cache, as well as the design exploration for a deeper discussion.
1 If your query contains parameterized fields, there is some work that the cache has to perform during read, in order to layer those fields on top of the static values within the cache.
Hermes is still early days! Some things it doesn't (yet!) support:
Union types: Hermes currently ignores union types and type constraints on fragments. It can just work, but you will likely run into trouble if you are expecting the cache to be able to differentiate stored state based on the node type.
writeData
: Hermes doesn't yet implement writeData
.
None of these are things that Hermes can't support; we just haven't had time to build those out yet. If you're interested in contributing, please feel free to hit us up; we'd love to work together to get them figured out!
Not too different from Apollo's in memory cache, but configuration is slightly different.
import { ApolloClient } from 'apollo-client';
import { Hermes } from 'apollo-cache-hermes';
const client = new ApolloClient({
cache: new Hermes({ … }),
// …
});
By default, the cache will consider all nodes with an id
field to be entities (e.g. normalized nodes in the graph).
For now, please refer to the source when looking up configuration values - they're likely to change, and new options to be added.
Interested in helping out? Awesome! If you've got an idea or issue, please feel free to file it, and provide as much context as you can.
If you're looking to contribute some code, it's pretty snappy to start development on this repository:
git clone https://github.com/convoyinc/apollo-cache-hermes
cd apollo-cache-hermes
yarn
# Leave this running while you're working on code — you'll receive immediate
# feedback on compile and test results for the files you're touching.
yarn dev
FAQs
A cache implementation for Apollo Client, tuned for performance
The npm package apollo-cache-hermes receives a total of 668 weekly downloads. As such, apollo-cache-hermes popularity was classified as not popular.
We found that apollo-cache-hermes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.