{"id":22870252,"url":"https://github.com/berquerant/cache-sh","last_synced_at":"2026-04-29T18:32:08.395Z","repository":{"id":245842893,"uuid":"818871722","full_name":"berquerant/cache-sh","owner":"berquerant","description":"Provides functions for simple cashing","archived":false,"fork":false,"pushed_at":"2025-09-22T23:09:15.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T01:08:36.883Z","etag":null,"topics":["bash"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berquerant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-23T05:40:03.000Z","updated_at":"2025-09-22T23:09:13.000Z","dependencies_parsed_at":"2024-06-24T12:33:39.483Z","dependency_job_id":"7a10259d-f3ee-46d6-b734-e80d2b3375e0","html_url":"https://github.com/berquerant/cache-sh","commit_stats":null,"previous_names":["berquerant/cache-sh"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/berquerant/cache-sh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fcache-sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fcache-sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fcache-sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fcache-sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/cache-sh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fcache-sh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439175,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["bash"],"created_at":"2024-12-13T13:14:19.081Z","updated_at":"2026-04-29T18:32:08.380Z","avatar_url":"https://github.com/berquerant.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cache-sh\n\nProvides functions for simple cashing.\n\n# Examples\n\n## Cache values and TTL\n\n``` shell\n. ./cache.sh\ncache_set key1 value1\ncache_get key1 # =\u003e value1\ncache_set key2 value2 3\ncache_get key2 # =\u003e value2\nsleep 4\ncache_get key2 # empty\n```\n\n## Cache by function argument\n\n``` shell\n. ./cache.sh\nadd1() {\n  sleep 1\n  expr 1 + $1\n}\ncache_function add1 1 # take 1 second to get 2\ncache_function add1 1 # get 2 instantly\n```\n\n## Cache by function input\n\n``` shell\n. ./cache.sh\ntest_rev() {\n  sleep 1\n  rev\n}\necho hoge | cache_function_io test_rev # egoh, take 1 second\necho hoge | cache_function_io test_rev # egoh, instantly\n```\n\n## Cache by function arguments\n\n``` shell\n. ./cache.sh\nadd() {\n    sleep 1\n    expr $(echo \"$*\" | sed 's/ / + /g')\n}\n\ncache_function_args add 1 2 # 3, take 1 second\ncache_function_args add 1 2 # 3, instantly\ncache_function_args add 1 2 3 # 6, take 1 second\n```\n\n## Cache by function arguments and input\n\n``` shell\n. ./cache.sh\nconcat() {\n    sleep 1\n    echo \"$(cat -)|$*\"\n}\n\necho hoge | cache_function_io_args concat 1 2 # hoge|1 2, take 1 second\necho hoge | cache_function_io_args concat 1 2 # hoge|1 2, instantly\necho foo | cache_function_io_args concat 1 2 # foo|1 2, take 1 second\necho foo | cache_function_io_args concat 1 2 3 # foo|1 2 3, take 1 second\necho foo | cache_function_io_args concat 1 2 3 # foo|1 2 3, instantly\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fcache-sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fcache-sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fcache-sh/lists"}