Skip to content

Vinamra7/cacher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cacher - Distributed Caching System

A robust and scalable distributed caching system built with Node.js, Redis, and MongoDB, designed to provide efficient key-value storage with user management capabilities.

Features

  • Distributed Caching: Efficient key-value storage across multiple nodes
  • User Management: Secure signup and authentication system
  • Memory Management: Dynamic memory allocation and monitoring
  • Azure Integration: Cloud-based capacity management
  • RESTful API: Clean and well-documented API endpoints

Technology Stack

  • Backend: Node.js with Express.js
  • Caching: Redis
  • Database: MongoDB with Mongoose
  • Authentication: bcrypt for password hashing
  • Other Tools:
    • Jenkins Hash for consistent hashing
    • Hash Ring for distributed caching
    • IORedis for Redis client
    • dotenv for environment management

Project Structure

cacher/
├── app.js                 # Application entry point
├── Bloom/                 # Bloom filter implementation
├── cCLI/                  # Command-line interface tools
├── config/                # Configuration files (MongoDB, etc.)
├── controller/            # API controllers
│   ├── cache_controller.js
│   ├── azure_controller.js
│   └── user_controller.js
├── helpers/              # Helper utilities
├── models/               # Database models
├── routes/               # API routes
└── scripts/              # Utility scripts

API Endpoints

Cache Operations

  • POST /cache/add-key: Add a key-value pair to cache
  • POST /cache/get-key: Retrieve a value by key

User Management

  • POST /user/signup: Create new user account
  • POST /user/signin: User authentication
  • POST /user/increase-allocation: Increase user's cache allocation
  • POST /user/get-allocated-memory: Get user's allocated memory
  • POST /user/get-used-memory: Get user's memory usage

System Operations

  • POST /used-capacity: Get system's used memory capacity

Installation

  1. Clone the repository:
git clone [repository-url]
cd cacher
  1. Install dependencies:
npm install
  1. Create a .env file with required environment variables:
PORT=3000
MONGODB_URI=your_mongodb_uri
REDIS_URL=your_redis_url
  1. Start the server:
npm start

Configuration

The system uses various configuration files located in the config directory:

  • MongoDB connection settings
  • Redis cluster configuration
  • Azure cloud settings

Security

  • Password hashing using bcrypt
  • Environment variable protection using dotenv
  • Secure session management

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Scalable Redis cache server implemented using consistent hashing for on-demand cache memory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors