SpringCacheDemo is a sample application that demonstrates how to implement caching within a Spring Boot application. It aims to showcase the usage of Spring's caching abstraction to optimize performance and resource utilization.
- Easy integration with Spring Boot
- Supports various caching providers (e.g., EhCache, Redis)
- Simple examples to demonstrate caching strategies
- RESTful API endpoints for resource access
SpringCacheDemo
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── springcachedemo
│ │ └── resources
│ │ └── application.properties
├── README.md
└── pom.xml
-
Clone the repository:
git clone https://github.com/kanniselvan/SpringCacheDemo.git cd SpringCacheDemo -
Install the required dependencies using Maven:
mvn install
-
Run the application:
mvn spring-boot:run
- Endpoint:
/api/resource/{id} - Method:
GET - Description: Retrieves a resource by its ID. The result is cached.
- Endpoint:
/api/cache/clear - Method:
POST - Description: Clears the cache for all resources.
curl -X GET http://localhost:8080/api/resource/1curl -X POST http://localhost:8080/api/cache/clear