Giter Site home page Giter Site logo

chakra-coder / spring-boot-caches-endpoint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ipalbeniz/spring-boot-caches-endpoint

0.0 1.0 0.0 22 KB

Spring Boot custom caches endpoint PoC

License: GNU General Public License v3.0

Java 100.00%

spring-boot-caches-endpoint's Introduction

Introduction

I was looking for a cache Spring Boot actuator endpoint because I wanted to clear some caches in a running application. But after some googling I only found this open issue: spring-projects/spring-boot#2625

So I decided to code my own actuator endpoint as a PoC.

Running the application

Run the demo application with mvn spring-boot:run

For the sake of simplicity a ConcurrentMapCache is configured.

# application.properties
spring.cache.type=simple

Anyway, you should be able to choose a different cache implementation:

mvn spring-boot:run -Dspring.cache.type=redis

Running the tests

Run the tests with mvn clean verify

Kudos to REST-assured for the great testing library!

Allowed operations

Warning! Some operations may not be suitable for production environments.

Get cache names grouped by cache manager

> curl http://localhost:8080/caches
{
    "cacheManager": [
        "cacheName1",
        "cacheName2"
    ]
}

Get cache names by cache manager

> curl http://localhost:8080/caches/cacheManager
[
    "cacheName1",
    "cacheName2"
]

Get cache keys

For now, only ConcurrentMap, Redis & EhCache are supported.

> curl http://localhost:8080/caches/cacheManager/cacheName1/keys
[
    "key10",
    "key1",
    "key2",
    "key5",
    "key6",
    "key3",
    "key4",
    "key9",
    "key7",
    "key8"
]

Clear cache

> curl -X DELETE http://localhost:8080/caches/cacheManager/cacheName1
> curl http://localhost:8080/caches/cacheManager/cacheName1/keys
[]

spring-boot-caches-endpoint's People

Contributors

ipalbeniz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.