{"id":21189416,"url":"https://github.com/boechat107/ring-ttl-session","last_synced_at":"2025-07-10T02:31:40.926Z","repository":{"id":35770304,"uuid":"40049938","full_name":"boechat107/ring-ttl-session","owner":"boechat107","description":"Provides an implementation of an in-memory ring SessionStore with TTL.","archived":false,"fork":false,"pushed_at":"2017-05-13T17:10:45.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-22T03:09:34.728Z","etag":null,"topics":["clojure","ring","ttl"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boechat107.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}},"created_at":"2015-08-01T14:56:53.000Z","updated_at":"2023-06-16T18:28:53.000Z","dependencies_parsed_at":"2022-07-08T15:00:24.886Z","dependency_job_id":null,"html_url":"https://github.com/boechat107/ring-ttl-session","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/boechat107/ring-ttl-session","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fring-ttl-session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fring-ttl-session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fring-ttl-session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fring-ttl-session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boechat107","download_url":"https://codeload.github.com/boechat107/ring-ttl-session/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boechat107%2Fring-ttl-session/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261386317,"owners_count":23150849,"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":["clojure","ring","ttl"],"created_at":"2024-11-20T18:52:14.767Z","updated_at":"2025-07-10T02:31:40.665Z","avatar_url":"https://github.com/boechat107.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ring-ttl-session\n\n![travis-status](https://travis-ci.org/boechat107/ring-ttl-session.svg)\n\nA session storage that stores session data in-memory with a time-to-live (TTL).\nIt's very similar to \n[ring.middleware.session.memory](https://github.com/ring-clojure/ring/wiki/Sessions),\nbut it may use [expiring-map](https://github.com/yogthos/expiring-map)\n(default) or [core.cache](https://github.com/clojure/core.cache) instead of\na Clojure's native map.\n\n## Installation\n\n[![Clojars Project](http://clojars.org/ring-ttl-session/latest-version.svg)](http://clojars.org/ring-ttl-session)\n\n## Usage\n\nThe difference from the Ring's native \n[in-memory session store](https://github.com/ring-clojure/ring/wiki/Sessions#session-stores)\nis minimal.\n\n```clojure\n(require '[ring.middleware.session :refer [wrap-session]]\n         '[ring-ttl-session.core :refer [ttl-memory-store]])\n\n(def app\n  ;; Using the default implementation, expiring-map.\n  (wrap-session handler {:store (ttl-memory-store (* 60 30))}))\n\n;; Using core.cache\n;; (ttl-memory-store (* 60 30) :core-cache)\n```\n\nThe argument of `ttl-memory-store` is the expiration time given in seconds\n(the example's session expires in 30 minutes). At least for now, it's\nrecommended to use the default implementation (expiring-map) because of it's\nlow performance overhead when compared with the bare in-memory session store \n(check the [`ring-ttl-session.performance` namespace](https://github.com/boechat107/ring-ttl-session/blob/develop/test/ring_ttl_session/performance.clj)\nor [this issue](https://github.com/boechat107/ring-ttl-session/issues/2)\nfor details).\n\n### Listeners\n\nAnother interesting feature of `expiring-map`, the default implementation, is\nthe support for listeners.\n\n```clojure\n(ttl-memory-store (* 60 30) {:listeners [(fn [k v] (println k v))]})\n```\n\nOther supported features and options can be checked in the \n[project's page](https://github.com/yogthos/expiring-map).\n\n## License\n\nCopyright © 2015 Andre Boechat\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboechat107%2Fring-ttl-session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboechat107%2Fring-ttl-session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboechat107%2Fring-ttl-session/lists"}