{"id":17921408,"url":"https://github.com/gotson/spring-session-caffeine","last_synced_at":"2025-07-07T03:09:56.325Z","repository":{"id":63748577,"uuid":"413446654","full_name":"gotson/spring-session-caffeine","owner":"gotson","description":"Spring Session for Caffeine","archived":false,"fork":false,"pushed_at":"2023-12-18T18:47:34.000Z","size":133,"stargazers_count":9,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T20:04:51.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gotson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-10-04T14:02:18.000Z","updated_at":"2025-01-06T10:10:39.000Z","dependencies_parsed_at":"2024-02-05T17:02:53.686Z","dependency_job_id":null,"html_url":"https://github.com/gotson/spring-session-caffeine","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/gotson/spring-session-caffeine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotson%2Fspring-session-caffeine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotson%2Fspring-session-caffeine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotson%2Fspring-session-caffeine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotson%2Fspring-session-caffeine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gotson","download_url":"https://codeload.github.com/gotson/spring-session-caffeine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gotson%2Fspring-session-caffeine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264005558,"owners_count":23542834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-28T20:33:43.740Z","updated_at":"2025-07-07T03:09:56.304Z","avatar_url":"https://github.com/gotson.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Session Caffeine [![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gotson/spring-session-caffeine/test.yml?branch=master)](https://github.com/gotson/spring-session-caffeine/actions/workflows/test.yml)\n\nProvides a `SessionRepository` implementation backed by a [Caffeine](https://github.com/ben-manes/caffeine) cache.\n\n## Features\n\n- respond to entries being added, evicted, and removed from the registry causes these events to trigger publishing\n  of `SessionCreatedEvent`, `SessionExpiredEvent`, and `SessionDeletedEvent` events (respectively) through\n  the `ApplicationEventPublisher`\n- automatically purge expired sessions\n- configure underlying cache by setting a specific `Scheduler` or `Executor`\n- implements `FindByIndexNameSessionRepository`, which can be used with `SpringSessionBackedSessionRegistry` if you need\n  to support Spring Security concurrent session control\n\n## When to use it?\n\n_Spring Session Caffeine_ is a good candidate when you need more capabilities than the default `MapSessionRepository`,\nlike events firing or automatic purging of expired sessions, or when you need a `FindByIndexNameSessionRepository`.\n\nIf you need those extra capabilities, you may consider _Spring Session Caffeine_ instead of other Spring Session Modules\nin the following cases:\n\n- Single instance. _Spring Session Caffeine_ will be more lightweight than _Spring Session Redis_ or _Spring Session\n  Hazelcast_, as those solutions depend on external systems, while Caffeine is a pure Java implementation. Caffeine is\n  not a distributed cache, so it will only work with a single instance.\n- No JDBC database. While _Spring Session JDBC_ can be a good candidate for a single instance service, you may not be\n  using a database already.\n- SQLite. When using _Spring Session JDBC_ with SQLite, the high number of writes can impact the performances of your\n  application when sharing the SQLite database between sessions and the rest of your application. In that case _Spring\n  Session Caffeine_ can be a good alternative.\n\n## Installation\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.gotson/spring-session-caffeine)](https://search.maven.org/artifact/com.github.gotson/spring-session-caffeine) [![javadoc](https://javadoc.io/badge2/com.github.gotson/spring-session-caffeine/javadoc.svg)](https://javadoc.io/doc/com.github.gotson/spring-session-caffeine)\n\n### Gradle\n\n```groovy\nimplementation \"com.github.gotson:spring-session-caffeine:{version}\"\n```\n\n### Gradle (Kotlin DSL)\n\n```kotlin\nimplementation(\"com.github.gotson:spring-session-caffeine:{version}\")\n```\n\n### Maven\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.gotson\u003c/groupId\u003e\n    \u003cartifactId\u003espring-session-caffeine\u003c/artifactId\u003e\n    \u003cversion\u003e{version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\n### Simple\n\n```java\n\n@EnableCaffeineHttpSession(maxInactiveIntervalInSeconds = 3600)\npublic class Config {\n}\n```\n\n### Advanced\n\n```java\n\n@EnableCaffeineHttpSession\npublic class Config {\n    @Bean\n    SessionRepositoryCustomizer\u003cCaffeineIndexedSessionRepository\u003e customize() {\n        return (sessionRepository -\u003e {\n            sessionRepository.setDefaultMaxInactiveInterval(Duration.ofDays(7).getSeconds());\n            sessionRepository.setExecutor(Executors.newFixedThreadPool(1));\n            sessionRepository.setScheduler(Scheduler.forScheduledExecutorService(Executors.newScheduledThreadPool(1)));\n        }\n        );\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotson%2Fspring-session-caffeine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgotson%2Fspring-session-caffeine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgotson%2Fspring-session-caffeine/lists"}