{"id":27595678,"url":"https://github.com/arcanemachine/local_file_cacher","last_synced_at":"2026-02-28T13:02:33.909Z","repository":{"id":287836629,"uuid":"965969074","full_name":"arcanemachine/local_file_cacher","owner":"arcanemachine","description":"  (NOT PRODUCTION-READY) Create a local file cache for files (e.g. API responses), and prune it to remove old files.","archived":false,"fork":false,"pushed_at":"2025-04-20T04:18:52.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T09:18:06.813Z","etag":null,"topics":["cache-storage","elixir","elixir-lang"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/local_file_cacher/LocalFileCacher.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arcanemachine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2025-04-14T07:42:23.000Z","updated_at":"2025-04-20T04:18:55.000Z","dependencies_parsed_at":"2025-04-14T08:18:48.837Z","dependency_job_id":"8c4f7013-52f8-4f88-a1d5-f17cc14a8656","html_url":"https://github.com/arcanemachine/local_file_cacher","commit_stats":null,"previous_names":["arcanemachine/local_file_cacher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcanemachine%2Flocal_file_cacher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcanemachine%2Flocal_file_cacher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcanemachine%2Flocal_file_cacher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arcanemachine%2Flocal_file_cacher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arcanemachine","download_url":"https://codeload.github.com/arcanemachine/local_file_cacher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250216164,"owners_count":21393913,"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":["cache-storage","elixir","elixir-lang"],"created_at":"2025-04-22T12:16:45.274Z","updated_at":"2026-02-28T13:02:33.854Z","avatar_url":"https://github.com/arcanemachine.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LocalFileCacher\n\n\u003e #### Warning\n\u003e\n\u003e This is very early release. It works but has some rough edges, and shouldn't be considered\n\u003e production-ready for most use cases.\n\nThis package manages a local file cache. The local file cache may be used, for example, to ensure\nthat you have backups of files saved when making HTTP requests to API providers. The cached files\ncan be used, for example, to quickly restore backups from the saved responses.\n\nThis package also allows old cached files to be pruned easily.\n\n## Getting started\n\n### Installation\n\nAdd this package to your list of dependencies in `mix.exs`, then run `mix deps.get`:\n\n```elixir\n{:local_file_cacher, \"0.1.2\"}\n```\n\n### Configuration\n\nTo configure this project, add the following to your runtime config (e.g. `config/runtime.exs`):\n\n```elixir\nconfig :local_file_cacher,\n  base_path: System.tmp_dir(),\n  days_to_keep_cached_files: 7\n```\n\n#### Configurable items\n\n- `:base_path` - The root directory that all your temporary files will go into.\n\n- `:days_to_keep_cached_files` - The number of days that a file will be kept before it is\neligible to be pruned. (The actual pruning is done by `LocalFileCacher.prune_file_cache!/2`.)\n\n### Usage\n\nNow that the configuration is complete, you may call the functions directly, or create some\nwrapper functions:\n\n`lib/your_project/some_api.ex`\n```elixir\ndefmodule YourProject.SomeApi do\n  def save_file_to_cache(file_cache_subdirectory_path, file_contents) do\n    LocalFileCacher.save_file_to_cache(\n      _application_context = __MODULE__,\n      file_cache_subdirectory_path,\n      file_contents,\n      _filename_suffix = \"json\"\n    )\n  end\n\n  def prune_file_cache(file_cache_subdirectory_path),\n    do: LocalFileCacher.prune_file_cache(__MODULE__, file_cache_subdirectory_path)\n\n  def get_some_endpoint do\n    file_cache_subdirectory_path = \"some_endpoint\"\n\n    with {:ok, resp} \u003c- Req.get(\"https://some-api.com/someEndpoint\"),\n      :ok \u003c- save_file_to_cache(file_cache_subdirectory_path, resp.body),\n      :ok \u003c- process_response(resp) do\n        prune_file_cache!(file_cache_subdirectory_path)\n      end\n    end\n  end\nend\n```\n\n---\n\nFor more information, see [this project's documentation](https://hexdocs.pm/local_file_cacher/LocalFileCacher.html).\n\n---\n\nThis project made possible by Interline Travel and Tour Inc.\n\nhttps://www.perx.com/\n\nhttps://www.touchdown.co.uk/\n\nhttps://www.touchdownfrance.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcanemachine%2Flocal_file_cacher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcanemachine%2Flocal_file_cacher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcanemachine%2Flocal_file_cacher/lists"}