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

@comake/solid-redis

v2.1.1

Published

A redis database backend for a Community Solid Server

Downloads

5

Readme

Redis database backend extension for the Community Solid Server

Store data in your Solid Pod with a Redis Database. Redis is an open source, in-memory data store.

Disclaimer: By default Redis saves snapshots of the dataset on disk, in a binary file called dump.rdb. This library does not alter these default persistence settings and does not include any extra calls to save the database to disk. Read more about persistence in redis.

Implementation details

For data with content type internal/quads, Solid Redis transforms quads into strings by concatenating their subject, predicate, and object values with the | (pipe) character. These strings are stored in Redis Sets. These Sets serve as the storage of the triples in LDP resources and their keys are the URIs of each resource. Solid Redis uses some special keys to store the metadata, children, and content type of resources.

Because Redis does not support empty Sets, for resources or metadata which should exist but contain no triples, Solid Redis stores a Set with a single dummy value of "1". These dummy values do not get exposed outside of the RedisDataAccessor class.

All other content types other than internal/quads are stored as strings. Redis can store any arbitrary binary data as a string up to 512Mb.

How to use Solid Redis

Install

From the npm package registry:

mkdir my-server
cd my-server
npm install @solid/[email protected] @comake/solid-redis

Install Redis

Follow Getting started with Redis to install and run Redis.

Configure

This extension can be used in 3 ways:

  1. As your CSS's backend to store pod data.
  2. As your CSS's key-value storage to store internal data (accounts, locks, tokens, etc.).
  3. As both!

1. As a backend

In your server's root folder (my-server or whatever the name of your project is) create a config.json file from this template (config-backend-example.json), and fill out your settings. The only important changes to make to the default config are to add solid-redis into @context and to change the backend storage to redis:

-"files-scs:config/storage/backend/*.json",
+"files-csr:config/storage/backend/redis.json",

2. As a key-value store

In your server's root folder create a config.json file from this template (config-key-value-store-example.json), and fill out your settings. The only important changes to make to the default config are to add solid-redis into @context and change the key-value storage to redis:

-"files-scs:config/storage/key-value/*.json",
+"files-csr:config/storage/key-value/redis.json",

3. As both

In your server's root folder create a config.json file from this template (config-all-storage-example.json), and fill out your settings. The only important changes to make to the default config are to add solid-redis into @context and change the backend and key-value storage to the global redis storage:

-"files-scs:config/storage/backend/*.json",
-"files-scs:config/storage/key-value/*.json"
+"files-csr:config/storage/backend/redis.json",
+"files-scs:config/storage/key-value/resource-store.json",

Configure the redis connection

Optionally, you can change the connection settings for your Redis database by adding parameters to the RedisDataAccessor in the @graph section of the config.json file you just created such as:

{
  "@id": "urn:solid-redis:default:RedisDataAccessor",
  "comment": "The configuration to connect to the Redis instance.",
  "RedisDataAccessor:_configuration_host": "52.22.22.22",
  "RedisDataAccessor:_configuration_port": "1234",
}

If you do not include this section, host defaults to localhost and port defaults to 6379, which are the Redis defaults.

You may optionally also include a username and password if your database requires them and a dbNumber if you don't use the default 0 database.

Run CSS

Execute the following command:

npx community-solid-server -c config.json -m .

Or add the command to scripts inside your package.json like so:

{
  "scripts": {
    "start": "npx community-solid-server -c config.json -m ."
  }
}

How to contribute to Solid Redis

Execute the following commands:

git clone https://github.com/comake/solid-redis.git
cd solid-redis
npm ci

TODO

  • [ ] Add support for different Redis modules such as:
    • RedisJSON so the json data can be updated & queried as JSON instead of strings
    • RediSearch to do full text search over the data in redis
  • [ ] Remove the Redis client mock in integration tests and have them run on CI in docker with a real redis instance

License

©2022-present Comake, Inc., MIT License