{"id":21053246,"url":"https://github.com/lsevero/memoize-ttl","last_synced_at":"2025-10-09T06:49:23.305Z","repository":{"id":62433453,"uuid":"344280958","full_name":"lsevero/memoize-ttl","owner":"lsevero","description":"A simple caching TTL strategy","archived":false,"fork":false,"pushed_at":"2021-05-04T15:41:09.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-06T13:56:32.406Z","etag":null,"topics":["cache","clojure","ttl-cache"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsevero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-03-03T22:27:25.000Z","updated_at":"2021-05-04T15:41:11.000Z","dependencies_parsed_at":"2022-11-01T21:01:43.090Z","dependency_job_id":null,"html_url":"https://github.com/lsevero/memoize-ttl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lsevero/memoize-ttl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fmemoize-ttl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fmemoize-ttl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fmemoize-ttl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fmemoize-ttl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsevero","download_url":"https://codeload.github.com/lsevero/memoize-ttl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fmemoize-ttl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000859,"owners_count":26082951,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":["cache","clojure","ttl-cache"],"created_at":"2024-11-19T16:05:18.409Z","updated_at":"2025-10-09T06:49:23.290Z","avatar_url":"https://github.com/lsevero.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# memoize-ttl\n\n[![Clojars Project](https://img.shields.io/clojars/v/lsevero/memoize-ttl.svg)](https://clojars.org/lsevero/memoize-ttl)\n\nA `clojure.core/memoize` version with a time-to-live strategy.\nIt mimics the interface of memoize and it is much more simplistic than [core.cache](https://github.com/clojure/core.cache).\nIf you need more control on the cache, consider switching to core.cache instead.\n\nThis library has no dependencies (besides clojure).\n## Usage\n\nJust pass the function you want to memoize to `memoize-ttl`, this function also receives a :ttl optional argument in seconds (defaults to 1 hour).\n\n```clojure\n(require '[memoize-ttl.core :refer [memoize-ttl]])\n\n(let [f (memoize-ttl (fn []\n                           (let [now (java.time.Instant/now)]\n                             (println \"executing function f at: \" now)\n                             now)) :ttl 10)\n          changes (atom 0)\n          last-ret (atom nil)]\n      (doseq [i (range 20)]\n        (let [ret (f)]\n          (println \"f returns: \" ret)\n          (when (not= ret @last-ret)\n            (do (swap! changes inc)\n                (reset! last-ret ret)))\n          (Thread/sleep 1000))))\n```\n\nWe also provides the `memoize-ttl-clean` function which returns a vector of the memoized function and a function to wipe the entire cache.\n\n## License\n\nCopyright © 2021 Lucas Severo.\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fmemoize-ttl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsevero%2Fmemoize-ttl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fmemoize-ttl/lists"}