Distributed Key-Value Cache Server

A simple distributed key-value cache server implemented in Node.js with user authentication. This project includes a TCP server that allows clients to connect, authenticate, and execute cache commands (SET, GET, HAS, Update, DELETE).

Features

  • User authentication (Login/Signup)
  • In-memory key-value store per user
  • Commands: SET, GET, HAS, Update, DELETE

Prerequisites

Setup

  1. Clone the repository or create a new project directory:

    git clone https://github.com/dushyant264/Custom_Cache
  2. Initialize Dependencies :

    npm i

Running the Server

  1. Start the Server:
    node server.js
    
  2. You should see
    Server started at 127.0.0.1:8080
    

Connecting to the Server

To interact with the server, you can use a TCP client. You can use telnet for simplicity, or any other TCP client you prefer.

  1. Open a Terminal and Connect Using telnet:
telnet 127.0.0.1 8080

Usage Examples

  1. SignUp
   SIGNUP
   Enter username: testuser
   Enter password: testpass
   User created successfully
  1. Login
  LOGIN
  Enter username: testuser
  Enter password: testpass
  Authenticated successfully
  1. Set
Set Key
Value
  1. Update
Update Key1
newVal
  1. Delete
DELETE key1
OK