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.
- 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
- 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
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
POST /cache/add-key: Add a key-value pair to cachePOST /cache/get-key: Retrieve a value by key
POST /user/signup: Create new user accountPOST /user/signin: User authenticationPOST /user/increase-allocation: Increase user's cache allocationPOST /user/get-allocated-memory: Get user's allocated memoryPOST /user/get-used-memory: Get user's memory usage
POST /used-capacity: Get system's used memory capacity
- Clone the repository:
git clone [repository-url]
cd cacher- Install dependencies:
npm install- Create a
.envfile with required environment variables:
PORT=3000
MONGODB_URI=your_mongodb_uri
REDIS_URL=your_redis_url- Start the server:
npm startThe system uses various configuration files located in the config directory:
- MongoDB connection settings
- Redis cluster configuration
- Azure cloud settings
- Password hashing using bcrypt
- Environment variable protection using dotenv
- Secure session management
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.