1.1.2 • Published 4 months ago

raito-cache v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

NPM Version Node.js CI Open Source Love MIT License

Raito-Cache

Table of contents

About

raito-cache - is lightweight caching proxy server. This server intercepts requests, caches responses, and serves them from the cache, improving performance by reducing redundant network calls. It also includes command line interface with command handling functionality.

Getting started

!IMPORTANT Node.js 18.x+ version must be installed in your OS.

1. Install server

$ yarn add -g raito-cache

2. Run the server

$ raito --port 3000 --password raitopass

CLI

Start the server:

Usage: raito --port <port> [options]

Lite caching proxy server

Options:
  --port <port>                 define port on which to start the server
  --host <host>                 define host on which to start the server (default: "localhost")
  --ttl <ms>                    define time to live for the cache record in ms
  -pass, --password <password>  define a password for the server to prevent non authorized connections
  -v, --version                 output the version number
  -h, --help                    display help for command

App commands:

  • status - check server status
  • stop - stop the server without exiting.
  • start - start the server
  • exit - stop the server and exit the process
  • clear-cache - deletes all records
  • ttl ms - time to live in milliseconds
  • get - get cache.
    • get * - get all records
    • get key - get cache by key
    • get HTTP_METHOD - get all cached responses from HTTP_METHOD requests. Example: get POST
    • get :ROUTE - get all cached responses from the specific route. Example: get :/tasks/2
    • get HTTP_METHOD:ROUTE - get a specific cached response
  • set key data ttl - create a new record with key and data. ttl - time to live for record (optional)
  • help - get all commands

Deployment

  1. Pull docker image:
    $ docker pull stbestich/raito-cache:latest_amd64
  2. Run it
    $ docker run -e HOST=<host> -e PASSWORD=<password> -p <port>:9180 -it stbestich/raito-cache

Use with docker-compose

services:
  raito-cache:
    image: stbestich/raito-cache:latest
    ports:
      - "${PORT:-9180}:${PORT:-9180}"
      - "${PORT:-9181}:${PORT:-9181" # Define second port if you need http proxy
    env_file:
      - .env
    environment:
      NODE_ENV: production
      PORT: ${PORT:-9180}
      HOST: ${HOST:-0.0.0.0}
      TTL: ${TTL}
      PASSWORD: ${PASSWORD}
    tty: true
    stdin_open: true

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Changelog

Project changes are writen in changelog, see the CHANGELOG.md.

We use SemVer for versioning. For the versions available, see the tags on this repository. For the versions supported, see the SECURITY.md.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md

1.1.2

4 months ago

1.1.0

5 months ago

1.0.0

7 months ago

0.0.2

7 months ago

0.0.1-s.1

7 months ago

0.0.1-stable

7 months ago

0.0.1

7 months ago

0.0.1-beta.2

7 months ago

0.0.1-beta.1

7 months ago