{"id":19693046,"url":"https://github.com/mdeket/ehcache-spring-metrics","last_synced_at":"2026-04-16T05:04:37.284Z","repository":{"id":90974094,"uuid":"127773557","full_name":"mdeket/ehcache-spring-metrics","owner":"mdeket","description":"Multi module maven project with admin server and application that uses ehcache.","archived":false,"fork":false,"pushed_at":"2018-04-05T12:39:07.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T11:58:26.721Z","etag":null,"topics":["admin-dashboard","admin-ui","caching","ehcache","ehcache-configuration","ehcache-spring","java","maven","multimodule","spring","spring-boot"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdeket.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-02T15:17:09.000Z","updated_at":"2018-04-05T12:39:08.000Z","dependencies_parsed_at":"2023-03-10T05:30:17.367Z","dependency_job_id":null,"html_url":"https://github.com/mdeket/ehcache-spring-metrics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdeket/ehcache-spring-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeket%2Fehcache-spring-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeket%2Fehcache-spring-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeket%2Fehcache-spring-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeket%2Fehcache-spring-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdeket","download_url":"https://codeload.github.com/mdeket/ehcache-spring-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdeket%2Fehcache-spring-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31872036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["admin-dashboard","admin-ui","caching","ehcache","ehcache-configuration","ehcache-spring","java","maven","multimodule","spring","spring-boot"],"created_at":"2024-11-11T19:15:32.381Z","updated_at":"2026-04-16T05:04:37.271Z","avatar_url":"https://github.com/mdeket.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Springboot application with admin server and application that uses EhCache\nAdmin server is only used to display metrics in a nicer, more human readable way. This app is also a service registry. \nIt loads all the necessary dependencies for it through spring-boot-admin dependency. You can read more about Codecentric's Admin Server [here](https://github.com/codecentric/spring-boot-admin).\n\nDemo application is a simple app that has only two endpoints, one that serves cached data and one that doesn't.\n\n```http://localhost:8081/api/demo``` - not cached\n\n```http://localhost:8081/api/demo/cached``` - cached data\n\nFor demo purposes I have used [Fake Response API](http://www.fakeresponse.com/) that has a possibility to set the amount of time you would like the response to be delayed which is perfect for testing caching of your API.\n\nExample: ```http://www.fakeresponse.com/api/?sleep=3```\n\n## Starting the apps\nIf you don't have maven installed, I recommend you to follow this step-by-step [tutorial](https://www.mkyong.com/maven/how-to-install-maven-in-windows/).\n\nClone the repo and go to ehcache-spring-metrics folder.\nIf you use IntelliJ, then just start AdminApplication and DemoApplication. Configurations for IntelliJ are already included.\nIf you want to start it from your terminal, run:\n```mvn install```\nThen start admin application by running ```mvn spring-boot:run -pl admin``` and open your browser on [http://localhost:8080](http://localhost:8080).\nOpen a new terminal go to the root of the project and run ```mvn spring-boot:run -pl application```  and open your browser on [http://localhost:8081](http://localhost:8081). You suppose to get Spring's Whitelabel Error page (404), if you didn't, well you did something wrong, just try again.\n\n## Actual usage\nTest the endpoint that I have mentioned above. The not-cached endpoint has sleep for 3 seconds as well as cached one when you hit it for the first time, after that endpoint with cached data will return response in a couple of milliseconds.\n\n## EhCache configuration\nAll of ehcache configuration can be found in ehcache.xml in resource folder.\nStatistics are enabled and cache alias for cached data is defined as ``fakeSlowData``. \nOne thing left is the annotation that will say what data to cache. Open DemoService class and look for the method ``getCachedData``. It has ``@Cacheable(\"fakeSlowData\")`` annotation that say that data returned from that function will be cached with alias ``fakeSlowData``.\n\n## Metrics\n1. In order to see the metrics, first you have to have cached data, so first fire a http request to ``http://localhost:8081/api/demo/cached``.\n2. Open admin app and go to the metrics tab.\n3. You will see a block with title ``cache`` which contains hit and miss ratio. Hit and miss ratio will update each time you send a request to ``/cached`` endpoint.\n\nKeep in mind that in ehcache.xml cache has expiry set for 10 seconds, that means that after 10 seconds cache with alias ``fakeSlowData`` will become empty and http request to FakeResponseAPI will be sent again in order to get new data to cache.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeket%2Fehcache-spring-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdeket%2Fehcache-spring-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdeket%2Fehcache-spring-metrics/lists"}