{"id":17465052,"url":"https://github.com/malvads/easycache","last_synced_at":"2025-04-19T20:15:37.166Z","repository":{"id":224747453,"uuid":"764098798","full_name":"malvads/easycache","owner":"malvads","description":"easy ruby gem for caching key-value data in mem (used in production at redborder)","archived":false,"fork":false,"pushed_at":"2024-02-29T12:51:32.000Z","size":43,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T12:46:56.905Z","etag":null,"topics":["cache","caching","easycache","easycaching","gem","key-value","key-value-storage","key-value-store","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/easycache/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/malvads.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,"dei":null}},"created_at":"2024-02-27T13:31:49.000Z","updated_at":"2024-07-19T05:39:08.000Z","dependencies_parsed_at":"2024-02-27T15:28:47.887Z","dependency_job_id":null,"html_url":"https://github.com/malvads/easycache","commit_stats":null,"previous_names":["malvads/easy-cache"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malvads%2Feasycache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malvads%2Feasycache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malvads%2Feasycache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malvads%2Feasycache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malvads","download_url":"https://codeload.github.com/malvads/easycache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249789606,"owners_count":21325849,"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","caching","easycache","easycaching","gem","key-value","key-value-storage","key-value-store","ruby","ruby-gem"],"created_at":"2024-10-18T11:08:38.080Z","updated_at":"2025-04-19T20:15:37.130Z","avatar_url":"https://github.com/malvads.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyCache\n\u003cp align=\"center\"\u003e\n\n[![Gem Version](https://badge.fury.io/rb/easycache.svg)](https://badge.fury.io/rb/easycache)\n![License](https://img.shields.io/badge/license-AGPL%203.0-blue.svg)\n[![Lint](https://github.com/malvads/easy-cache/actions/workflows/lint.yml/badge.svg)](https://github.com/malvads/easy-cache/actions/workflows/lint.yml)\n[![Tests](https://github.com/malvads/easycache/actions/workflows/tests.yml/badge.svg)](https://github.com/malvads/easycache/actions/workflows/tests.yml)\n[![Build](https://github.com/malvads/easycache/actions/workflows/build.yml/badge.svg)](https://github.com/malvads/easycache/actions/workflows/build.yml)\n\u003c/p\u003e\n\nMaybe not the best caching system, but its a caching system :)\n\nEasyCache is an in-memory cache system for Ruby designed for situations where you don't want to set up Redis or Memcached but still need a simple solution for caching key-value data in the `process` memory.\n\n## Install\n\n```\ngem install easycache\n```\n\n## Usage\n\nTo use EasyCache in your Ruby project, require the library and include it in your code:\n\n```ruby\nrequire 'easycache'\n\ncache = EasyCache.new\n```\n\n## Storing data\n\n```ruby\nkey = \"my_key\"\ncache_ttl = 3600\nstore_in_mem = true\ndata = cache.fetch(cache_key, cache_ttl, store_in_mem) do\n    my_http_get\nend\n```\n\nNow data is in-mem for the next 3600 second (store_in_mem variable is important for storing data first time).\n\n## Getting data\n\nIf i want to get the data stored in mem i do\n\n```ruby\ndata = cache.fetch(\"my_key\")\n```\n\nor i can also re-call the same function\n\n```ruby\ndata = cache.fetch(\"my_key\", cache_ttl, store_in_mem) do\n    my_http_get\nend\n```\n\nbecause the data is already cached, so it will not call the block, it will return the cached data instead.\n\nThis will output the cached data, remember that cached data is stored in mem for only 3600 seconds\n\n## Examples\n\nYou can search for examples in `examples` folder for caching http requests and responses using EasyCache\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/malvads/easycache .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalvads%2Feasycache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalvads%2Feasycache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalvads%2Feasycache/lists"}