https://github.com/chandrakanthrck/mempersistcachesystem
A caching solution providing in-memory and persistent storage options with synchronized data handling. Includes features for measuring and comparing latency between storage types.
https://github.com/chandrakanthrck/mempersistcachesystem
cache in-memory-caching java metrics performance-optimization persistence prometheus spring-boot
Last synced: 3 months ago
JSON representation
A caching solution providing in-memory and persistent storage options with synchronized data handling. Includes features for measuring and comparing latency between storage types.
- Host: GitHub
- URL: https://github.com/chandrakanthrck/mempersistcachesystem
- Owner: chandrakanthrck
- License: mit
- Created: 2024-09-20T23:24:58.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-04T00:34:37.000Z (7 months ago)
- Last Synced: 2025-01-11T13:29:40.585Z (5 months ago)
- Topics: cache, in-memory-caching, java, metrics, performance-optimization, persistence, prometheus, spring-boot
- Language: Java
- Homepage:
- Size: 101 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MemPersistCacheSystem
A caching solution with options for in-memory or persistent storage, ensuring synchronization between both. This project includes functionality to measure and compare latency between storage types.
## Features
- **In-Memory Caching**: Fast data access using an in-memory cache.
- **Persistent Storage**: Data can be stored persistently in a relational database (e.g., MySQL).
- **Synchronization**: Ensures data consistency between in-memory cache and persistent storage.
- **Latency Measurement**: Compare read and write latencies between in-memory and persistent storage.
- **Custom Eviction Policies**: Implemented eviction strategies such as LRU (Least Recently Used) and TTL (Time-to-Live).
- **Metrics Monitoring**: Integration with Micrometer for performance tracking and monitoring.## Technologies Used
- **Java**: Primary programming language.
- **Spring Boot**: Framework for building the application.
- **MySQL**: Persistent storage solution.
- **Micrometer**: For metrics collection and monitoring.
- **JUnit & Mockito**: For unit testing and mocking dependencies.## Getting Started
### Prerequisites
- Java 17 or higher
- Maven
- MySQL Database### Installation
1. Clone the repository:
```bash
git clone https://github.com/chandrakanthrck/MemPersistCacheSystem.git
cd MemPersistCacheSystem
```2. Configure your `application.properties` for database connection:
```properties
spring.datasource.url=jdbc:mysql://localhost:3306/your_db_name
spring.datasource.username=your_username
spring.datasource.password=your_password
```3. Run the application:
```bash
mvn spring-boot:run
```## Usage
### API Endpoints
- **PUT** data into the cache:
```
POST /cache/put?key={key}&value={value}
```- **GET** data from the cache:
```
GET /cache/get?key={key}
```- **REMOVE** data from the cache:
```
DELETE /cache/remove?key={key}
```- **Metrics** monitoring:
```
GET /actuator/prometheus
```## Testing
Run unit tests using Maven:
```bash
mvn test
```## Contributing
Contributions are welcome! Please open an issue or submit a pull request if you'd like to contribute.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.