{"id":18418561,"url":"https://github.com/bsm/timed_lru","last_synced_at":"2025-04-07T13:31:19.892Z","repository":{"id":7246306,"uuid":"8556755","full_name":"bsm/timed_lru","owner":"bsm","description":"Simple, thread-safe LRU with (optional) TTLs and constant time operations","archived":false,"fork":false,"pushed_at":"2024-08-01T23:44:48.000Z","size":25,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T22:46:27.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsm.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":"2013-03-04T14:06:05.000Z","updated_at":"2022-06-06T08:31:08.000Z","dependencies_parsed_at":"2022-09-07T04:00:24.888Z","dependency_job_id":null,"html_url":"https://github.com/bsm/timed_lru","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Ftimed_lru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Ftimed_lru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Ftimed_lru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Ftimed_lru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsm","download_url":"https://codeload.github.com/bsm/timed_lru/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247661653,"owners_count":20975095,"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-11-06T04:14:00.539Z","updated_at":"2025-04-07T13:31:19.604Z","avatar_url":"https://github.com/bsm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Timed LRU\n\n[![Build Status](https://github.com/bsm/timed_lru/actions/workflows/ruby.yml/badge.svg)](https://github.com/bsm/timed_lru/actions/workflows/ruby.yml)\n[![Dependency Status](https://gemnasium.com/bsm/timed_lru.png)](https://gemnasium.com/bsm/timed_lru)\n\nMy implementation of a simple, thread-safe LRU with (optional) TTLs\nand constant time operations. There are many LRUs for Ruby available but\nI was unable to find one that matches all three requirements.\n\n## Install\n\nInstall it via `gem`:\n\n```ruby\ngem install timed_lru\n```\n\nOr just bundle it with your project.\n\n## Usage Example\n\n```ruby\n# Initialize with a max size (default: 100) and a TTL (default: none)\nlru = TimedLRU.new max_size: 3, ttl: 5\n\n# Add values\nlru[\"a\"] = \"value 1\"\nlru[\"b\"] = \"value 2\"\nlru[\"c\"] = \"value 3\"\nlru.keys # =\u003e [\"a\", \"b\"]\n\n# Wait a second\nsleep(1)\n\n# Add more values\nlru[\"d\"] = \"value 4\"\nlru.keys # =\u003e [\"b\", \"c\", \"d\"]\n\n# Sleep a little longer\nsleep(4)\nlru[\"c\"] # =\u003e \"value 3\"\nlru.keys # =\u003e [\"c\", \"d\"]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Ftimed_lru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsm%2Ftimed_lru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Ftimed_lru/lists"}