{"id":13411990,"url":"https://github.com/rtomayko/rack-cache","last_synced_at":"2025-05-16T18:07:12.018Z","repository":{"id":445069,"uuid":"67542","full_name":"rtomayko/rack-cache","owner":"rtomayko","description":"Real HTTP Caching for Ruby Web Apps","archived":false,"fork":false,"pushed_at":"2022-03-04T03:57:50.000Z","size":952,"stargazers_count":824,"open_issues_count":35,"forks_count":122,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-12T16:58:39.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rtomayko.github.io/rack-cache/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtomayko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-10-25T02:02:09.000Z","updated_at":"2025-04-07T07:35:33.000Z","dependencies_parsed_at":"2022-07-07T14:41:01.088Z","dependency_job_id":null,"html_url":"https://github.com/rtomayko/rack-cache","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtomayko%2Frack-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtomayko%2Frack-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtomayko%2Frack-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtomayko%2Frack-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtomayko","download_url":"https://codeload.github.com/rtomayko/rack-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582907,"owners_count":22095518,"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-07-30T20:01:19.862Z","updated_at":"2025-05-16T18:07:11.997Z","avatar_url":"https://github.com/rtomayko.png","language":"Ruby","readme":"# Moved to https://github.com/rack/rack-cache\n\nRack::Cache\n===========\n\nRack::Cache is suitable as a quick drop-in component to enable HTTP caching for\nRack-based applications that produce freshness (Expires, Cache-Control) and/or\nvalidation (Last-Modified, ETag) information:\n\n  * Standards-based (RFC 2616)\n  * Freshness/expiration based caching\n  * Validation (If-Modified-Since / If-None-Match)\n  * Vary support\n  * Cache-Control: public, private, max-age, s-maxage, must-revalidate,\n    and proxy-revalidate.\n  * Portable: 100% Ruby / works with any Rack-enabled framework\n  * Disk, memcached, and heap memory storage backends\n\nFor more information about Rack::Cache features and usage, see:\n\nhttps://rtomayko.github.com/rack-cache/\n\nRack::Cache is not overly optimized for performance. The main goal of the\nproject is to provide a portable, easy-to-configure, and standards-based\ncaching solution for small to medium sized deployments. More sophisticated /\nhigh-performance caching systems (e.g., Varnish, Squid, httpd/mod-cache) may be\nmore appropriate for large deployments with significant throughput requirements.\n\nInstallation\n------------\n\n    gem install rack-cache\n\nBasic Usage\n-----------\n\n`Rack::Cache` is implemented as a piece of Rack middleware and can be used with\nany Rack-based application. If your application includes a rackup (`.ru`) file\nor uses Rack::Builder to construct the application pipeline, simply require\nand use as follows:\n\n```Ruby\nrequire 'rack/cache'\n\nuse Rack::Cache,\n  metastore:    'file:/var/cache/rack/meta',\n  entitystore:  'file:/var/cache/rack/body',\n  verbose:      true\n\nrun app\n```\n\nAssuming you've designed your backend application to take advantage of HTTP's\ncaching features, no further code or configuration is required for basic\ncaching.\n\nUsing with Rails\n----------------\n\n```Ruby\n# config/application.rb\nconfig.action_dispatch.rack_cache = true\n# or\nconfig.action_dispatch.rack_cache = {\n   verbose:     true,\n   metastore:   'file:/var/cache/rack/meta',\n   entitystore: 'file:/var/cache/rack/body'\n}\n```\n\nYou should now see `Rack::Cache` listed in the middleware pipeline:\n\n    rake middleware\n\n[more information](https://snippets.aktagon.com/snippets/302-how-to-setup-and-use-rack-cache-with-rails)\n\nUsing with Dalli\n----------------\n\nDalli is a high performance memcached client for Ruby.\nMore information at: https://github.com/mperham/dalli\n\n```Ruby\nrequire 'dalli'\nrequire 'rack/cache'\n\nuse Rack::Cache,\n  verbose:  true,\n  metastore:    \"memcached://localhost:11211/meta\",\n  entitystore:  \"memcached://localhost:11211/body\"\n\nrun app\n```\n\nNoop entity store\n-----------------\n\nDoes not persist response bodies (no disk/memory used).\u003cbr/\u003e\nResponses from the cache will have an empty body.\u003cbr/\u003e\nClients must ignore these empty cached response (check for X-Rack-Cache response header).\u003cbr/\u003e\nAtm cannot handle streamed responses, patch needed.\n\n```Ruby\nrequire 'rack/cache'\n\nuse Rack::Cache,\n verbose: true,\n metastore: \u003cany backend\u003e\n entitystore: \"noop:/\"\n\nrun app\n```\n\nIgnoring tracking parameters in cache keys\n-----------------\n\nIt's fairly common to include tracking parameters which don't affect the content\nof the page. Since Rack::Cache uses the full URL as part of the cache key, this\ncan cause unneeded churn in your cache. If you're using the default key class\n`Rack::Cache::Key`, you can configure a proc to ignore certain keys/values like\nso:\n\n```Ruby\nRack::Cache::Key.query_string_ignore = proc { |k, v| k =~ /^(trk|utm)_/ }\n```\n\nLicense: MIT\u003cbr/\u003e\n[![Build Status](https://travis-ci.org/rtomayko/rack-cache.svg)](https://travis-ci.org/rtomayko/rack-cache)\n","funding_links":[],"categories":["Ruby","Caching","Middlewares"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtomayko%2Frack-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtomayko%2Frack-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtomayko%2Frack-cache/lists"}