A remote nodejs Cache Server, for you to have your perfect MAP Cache Saved and useable remotely. Easy Server and Client Creations, fast, stores the Cache before stopping and restores it again!

Overview

Built with Love Made with Javascript

Discord server NPM version NPM downloads Get Started Now Patreon

npm installnfo

remote-map-cache

A remote nodejs Cache Server, for you to have your perfect MAP Cache Saved and useable remotely. Easy Server and Client Creations, fast, stores the Cache before stopping and restores it again!

Installation

npm install https://github.com/Tomato6966/remote-map-cache
npm install remote-map-cache

Usage

  1. Create the Cache (which can be used as a DB TOO!) - Create a File-Folder-Project, at your CACHE SERVER and put in this Code:
Click to see the Code
const { remoteCacheServer } = require("../../remote-map-cache/index");

const Server = new remoteCacheServer({
    username: "TheUserNameForTheCacheServer",
    password: "ThePasswordForTheCacheServer",
    port: 4040, // Any port
    tls: true
});
// Following Events are optional
Server
    .on("serverReady", () => {
        console.log("DatabaseCacheServer ready and waiting for connections");
    })
    .on("serverError", (error) => {
        console.error("DatabaseCacheServer error, ERROR:\n", error, "\n---\n");
    })
    .on("serverClose", (reason) => {
        console.log("DatabaseCacheServer closed");
    })
    .on("serverConnect", (connection, payload) => {
        console.log("DatabaseCacheServer a Client Connected");
    })
    .on("serverDisconnect", (connection, reason) => {
        console.log("DatabaseCacheServer a Client Disconnected");
    })
    .on("serverMessage", (message) => {
        // console.log("DatabaseCacheServer, received a Message", message);
    })
    .on("serverRequest", async (request, response, client) => {
        // console.log("DatabaseCacheRequest, received a Request", request);
    });
  1. To connect the cache do this:
Click to see the Code
const { remoteCacheClient, remoteCacheServer } = require("../../remote-map-cache/index");
const client = new remoteCacheClient({
    username: "db_cache",
    password: "db_cache",
    host: "localhost",
    port: 5000,
    tls: true
})

// following events are optional
client
    .on("cacheReady", () => {
        console.log("DATABASECACHECLIENT ready and connected");
    })
    .on("cacheError", (error) => {
        console.error("DATABASECACHECLIENT error, ERROR:\n", error, "\n---\n");
    })
    .on("cacheClose", (reason) => {
        console.log("DATABASECACHECLIENT closed, REASON?:\n", reason, "\n---\n");
    })
    .on("cacheMessage", (message) => {
        console.log("message", message);
    })
    .on("cacheRequest", async (request, response, client) => {
        console.log("REQUEST", request);
    });

// example usage
async function yourProgram(){
    await client.set("hi", "bye").then(console.log).catch(console.error);
    await client.get("hi").then(console.log).catch(console.error);
    await client.set("array", []).then(console.log).catch(console.error);
    await client.push("array", "element").then(console.log).catch(console.error);
    await client.push("array", "element2").then(console.log).catch(console.error);
    await client.size().then(console.log).catch(console.error);
    await client.get("array").then(console.log).catch(console.error);
    await client.all().then(console.log).catch(console.error);
}

yourProgram();

Methods (Functions) for the CACHE-CLIENT(s)

  • get(key)
  • set(key)
  • add(key, amount)
  • push(key, element)
  • has(key)
  • delete(key)
  • clear() clears the whole cache Map
  • all() / values() array of all values
  • entries() array of [key, value]
  • keys() array of all keys
  • ping() shows the ping
  • size() shows the cache-map-size

Events for the CACHE-SERVER

  • serverReady shows when the server is ready, you don't need to listen to it!
  • serverError shows when the server errors, you don't need to listen to it!
  • serverClose shows when the server closes, you don't need to listen to it!
  • serverConnect shows when a client connects, you don't need to listen to it!
  • serverDisconnect shows when a client disconnects, you don't need to listen to it!
  • serverMessage receives messages from a cache-client, you don't need to listen to it!
  • serverRequest received requets from a cache-client, used for sending the cache datas, you don't need to listen to it!

Events for the CACHE-Client(s)

  • cacheReady shows when the server is ready, you don't need to listen to it!
  • cacheError shows when the server errors, you don't need to listen to it!
  • cacheClose shows when the server closes, you don't need to listen to it!
  • cacheMessage receives messages from the cache-server, you don't need to listen to it!
  • cacheRequest receives requets from the cache-server, you don't need to listen to it!
You might also like...

open-source implementation of the Turborepo custom remote cache server.

open-source implementation of the Turborepo custom remote cache server.

This project is an open-source implementation of the Turborepo custom remote cache server. If Vercel's official cache server isn't a viable option, th

Dec 30, 2022

Simple utils to pack arrays, objects and strings to a flat object (and back again).

packrup Simple utils to pack (and unpack) arrays and strings to a flat object. Status: In Development Please report any issues 🐛 Made possible by my

Dec 23, 2022

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again.

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again.

Timers for Lost Ark bosses, islands, events, wandering merchants and more! Never miss an event again. LostArkTimer.app Website Website Features Event

Oct 17, 2022

Run a command, watch the filesystem, stop the process on file change and then run the command again...

hubmon Run a command, watch the filesystem, stop the process on file change and then run the command again... Install You can install this command lin

Jul 30, 2022

Edrys is an open-source app that helps you teach remotely.

Edrys is an open-source app that helps you teach remotely.

The Open Remote Teaching Platform 📰 Join our newsletter for updates & community showcases! Edrys is an open-source app that helps you teach remotely.

Dec 13, 2022

A lazy plugin for printing local network when starting NodeJS server. I made this so you don't have to.

A lazy plugin for printing local network when starting NodeJS server. I made this so you don't have to.

lazy-net A simple, lightweight plugin for printing local network when starting Node.js or Express.js server. I made this so you don't have to. There a

Feb 10, 2022

A project that let's you see a list of scores using an API, you can add ypur own and it will be saved on the list forever

Leaderboard This is a project that let's you see a list of scores using an API, you can add ypur own and it will be saved on the list forever! Built W

Mar 4, 2022

aka Scaletor, take screenshots of a piece of a map and scale/compare with other parts of the map

scale-a-tron A quick-and-dirty map that lets you compare one area to another. Draw a shape around a region, zoom in to another place on the map, and c

Nov 7, 2022
Comments
  • Adding types

    Adding types

    It would be cool, if you added types so that typescript users can use this package too!

    https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

    opened by jedddg 1
Owner
Tomato6966
I am Tomato, around about 18, and a very good Discord Bot Developer, Dm me on Discord: Tomato#6966, to get one yourself!
Tomato6966
Web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control.

Linux Remote This is a web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control. Do

Gabriel Guerra 4 Jul 6, 2022
Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

khimaros 40 Dec 23, 2022
A web app which help you to save you a list of your favorite books, they will be saved on your local storage to never loose them even if you close the page. Built wiht JavaScript

Awesome Books In this project I build a page to save a list of your favorites books, you can add new books, delete it and they will be saved in the lo

Williams Colmenares 9 Dec 17, 2022
zieeco 12 Jul 8, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till mÀnniskor pÄ flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
💡 Providing equitable access to human useable Web3 data.

?? Providing equitable access to human useable Web3 data. Unidata The beauty of Web3 is that everyone owns their data, but accessing and displaying ow

DIYgod 264 Jan 2, 2023
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
JOSE ZEPEDA 10 Nov 18, 2022