{"id":18981669,"url":"https://github.com/kryptonbutterfly/tinycache-example","last_synced_at":"2025-11-10T17:03:22.790Z","repository":{"id":147291915,"uuid":"538545949","full_name":"kryptonbutterfly/tinyCache-Example","owner":"kryptonbutterfly","description":"an Example for the tinyCache library and the CacheBuilder ByteCode manipulator","archived":false,"fork":false,"pushed_at":"2022-09-19T15:40:16.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T11:28:18.100Z","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/kryptonbutterfly.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}},"created_at":"2022-09-19T14:35:33.000Z","updated_at":"2022-09-19T14:42:22.000Z","dependencies_parsed_at":"2024-01-18T23:23:56.473Z","dependency_job_id":null,"html_url":"https://github.com/kryptonbutterfly/tinyCache-Example","commit_stats":null,"previous_names":["kryptonbutterfly/tinycache-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kryptonbutterfly%2FtinyCache-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kryptonbutterfly%2FtinyCache-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kryptonbutterfly%2FtinyCache-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kryptonbutterfly%2FtinyCache-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kryptonbutterfly","download_url":"https://codeload.github.com/kryptonbutterfly/tinyCache-Example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239985912,"owners_count":19729542,"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-08T16:10:49.357Z","updated_at":"2025-11-10T17:03:22.733Z","avatar_url":"https://github.com/kryptonbutterfly.png","language":"Java","readme":"# tinyCache Example\n\nThis is an example of the tinyCache library in combination with CacheBuilder ByteCode manipulator.\n\n## Components\n\nDescription          | Project\n:------------------- | :------\ndependency           | [tinyCache](https://github.com/tinycodecrank/tinyCache)\nbytecode manipulator | [CacheBuilder](https://github.com/tinycodecrank/CacheBuilder)\n\n## Example\n\n```java\nstatic int invocations = 0;\n\n@Cache(cache = FIFOCache.class, capacity = 2)\npublic static int fibonacci(int n)\n{\n  invocations++;\n  if (n == 0 || n == 1)\n    return n;\n  else\n    return fibonacci(n - 2) + fibonacci(n - 1);\n}\n\npublic void main(String[] args)\n{\n  int n = 10;\n  System.out.println(\"fibonacci(\" + n + \") =\u003e \" + fibonacci(n));\n  System.out.println(\"invocations \" + invocations);\n}\n```\n\n##### Output\n```shell\nfibonacci(10) =\u003e 55\ninvocations 11\n```\n\nIn this example the @Cache annotation causes the function ```int fibonacci(int n)``` to be wrapped in a FIFO cache with capacity 2, avoiding recomputation of already computed values.\nThis reduces the invocation count for a given n ∊ ℕ from ≈2\u003csup\u003en\u003c/sup\u003e to ≈n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkryptonbutterfly%2Ftinycache-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkryptonbutterfly%2Ftinycache-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkryptonbutterfly%2Ftinycache-example/lists"}