{"id":45893053,"url":"https://github.com/hotchemi/LruCache","last_synced_at":"2026-03-13T06:00:52.637Z","repository":{"id":25656585,"uuid":"29092041","full_name":"hotchemi/LruCache","owner":"hotchemi","description":"A tiny memory cache implementation which uses a LRU policy.","archived":false,"fork":false,"pushed_at":"2018-03-11T03:36:27.000Z","size":164,"stargazers_count":76,"open_issues_count":1,"forks_count":30,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T04:03:57.964Z","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/hotchemi.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-01-11T13:08:05.000Z","updated_at":"2023-12-15T22:24:28.000Z","dependencies_parsed_at":"2022-08-24T14:12:43.271Z","dependency_job_id":null,"html_url":"https://github.com/hotchemi/LruCache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hotchemi/LruCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotchemi%2FLruCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotchemi%2FLruCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotchemi%2FLruCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotchemi%2FLruCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hotchemi","download_url":"https://codeload.github.com/hotchemi/LruCache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hotchemi%2FLruCache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30459760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T03:55:51.346Z","status":"ssl_error","status_checked_at":"2026-03-13T03:55:33.055Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-27T19:00:39.317Z","updated_at":"2026-03-13T06:00:52.631Z","avatar_url":"https://github.com/hotchemi.png","language":"Java","funding_links":[],"categories":["缓存库"],"sub_categories":["Spring Cloud框架"],"readme":"# LruCache\n\n[![Build Status](https://travis-ci.org/hotchemi/LruCache.svg)](https://travis-ci.org/hotchemi/LruCache)\n\nA tiny, thread safe memory cache implementation which uses a LRU policy.\n\n\u003e This implementation gives priority to simplicity of API.\n\u003e If you want to use a rich API, Use the `LruCache` in Android framework.\n\n## How to use\n\n### Cache\n\n[`Cache`](https://github.com/hotchemi/LruCache/blob/master/src/main/java/hotchemi/com/github/Cache.java) is a interface.\n\nIt provides six methods as bellow.\n\n- `V get(K key)` - Gets an value for the specified key.\n- `V put(K key, V value)` - Puts an value in the cache for the specified key.\n- `V remove(K key)` - Removes the entry for key.\n- `void clear()` - Clears all the entries in the cache.\n- `int getMaxMemorySize()` - Returns the max memory size of the cache.\n- `int getMemorySize()` - Returns the current memory size of the cache.\n\n#### LruCache\n\n[`LruCache`](https://github.com/hotchemi/LruCache/blob/master/src/main/java/hotchemi/com/github/LruCache.java)'s API is definitely simple.\n\n```java\nCache\u003cString, String\u003e cache = new LruCache\u003c\u003e();\ncache.put(\"a\", \"A\");\n```\n\n#### Note\n\n- Default cache item capacity is ten. You can change the capacity via constructor.\n- Please override the `getValueSize` if you control memory size correctly.\n\n### BitmapLruCache\n\n[`BitmapLruCache`](https://github.com/hotchemi/LruCache/blob/master/src/main/java/hotchemi/com/github/BitmapLruCache.java) is the class that specialized in caching `Bitmap`.\n\n```java\nprivate static final Bitmap A = Bitmap.createBitmap(1, 1, ALPHA_8);\n\nCache cache = new BitmapLruCache();\ncache.put(\"a\", A);\n```\n\n## Test\n\n```sh\nmvn clean test\n```\n\n## Support\n\nJava 1.7 or greater.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotchemi%2FLruCache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhotchemi%2FLruCache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhotchemi%2FLruCache/lists"}