npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emberql

v1.0.4

Published

EmberQL is an intuitive, lightweight Node module that facilitates caching data from GraphQL queries, and implements a dynamic data persistence system that monitors the status of the primary database and modifies cache invalidation accordingly.

Downloads

11

Readme

EmberQL

License: MIT

What is EmberQL?

EmberQL is an intuitive, lightweight Node module that facilitates caching data from GraphQL queries, and implements a dynamic data persistence system that monitors the status of the primary database and modifies cache invalidation accordingly.

Features

Server-side caching with Redis to decrease query times

Decrease the time it takes for your users to fetch data from your database by up to one hundred fold. Research shows that even a second of latency will drastically increase bounce rates on your application. Additionally, depending on the specifications or hosting of your database, too many simultaneous queries can cause timeouts to occur. Using EmberQL, there is no need to gamble with forcing your users to make redundant queries to your database.

Dynamic cache invalidation

EmberQL incorporates a smart "heartbeat" feature that will monitor your database in real time and halt cache invalidation when it detects downtime. This is done by periodically increasing the time to live of cached data, and as soon as the database comes back online cached items will revert to being evicted normally. The heartbeat will communicate relevant information to the developer in the server console.

Data persistence system utilizing RDB (Redis Database) and AOF (Append Only File)

In the event of your database going down, the most relevant information users are querying will be available in the in-memory database and thus available to users. With EmberQL, there is no need for your clients to notice when your database isn't running. You can rest assured that your application will have fault tolerance after installing the module.

Installation & Prerequisites

You can install the EmberQL module into your Node.js application by running the command npm install emberql. Your application must have GraphQL and as a dependency, and you will need to define your schema so that EmberQL can make use of it. You will also need Redis as a dependency to access the Redis functions (createClient, connect, on, etc.) and you will need to either run a Redis server on your machine locally or utilize AWS Elasticache to run a Redis server.

Implementation

You The EmberQL class will take your GraphQL schema and your Redis cache instance as arguments:

const Ember = new EmberQL(schema, redisCache);

Any request sent to '/graphql' should be routed through the handleQuery middleware:

app.use('/graphql', Ember.handleQuery, (req, res) => {
  res.status(202).json(res.locals.data);
});

To clear the Redis cache, send a request to the '/clearCache' endpoint and route it through the EmberQL clearCache method:

app.use('/clearCache', Ember.clearCache, (req, res) => {
  res.sendStatus(202);
});

Features in Production

Data normalization for Redis caching is currently in our development pipeline. The prototype utilizes a recursive function to parse the GraphQL AST and transform queries into key value pairs utilizing hashing to optimize memory.

EmberQL Engineering Team

Cristian De Los Rios | Manjunath Ajjappa Pattanashetty | Mike Masatsugu | Ram Marimuthu | Tyler Pohn