https://github.com/rack/rack-cache
https://github.com/rack/rack-cache
Keywords from Contributors
activerecord activejob mvc rubygems sinatra rack background-jobs crash-reporting sidekiq jobs
Last synced: about 16 hours ago
JSON representation
Repository metadata
- Host: GitHub
- URL: https://github.com/rack/rack-cache
- Owner: rack
- License: other
- Created: 2022-02-22T07:43:02.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T07:26:02.000Z (almost 2 years ago)
- Last Synced: 2026-01-30T21:59:45.910Z (about 1 month ago)
- Language: Ruby
- Size: 959 KB
- Stars: 39
- Watchers: 1
- Forks: 16
- Open Issues: 3
- Releases: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: MIT-LICENSE
README.md
Rack::Cache
Rack::Cache is suitable as a quick drop-in component to enable HTTP caching for
Rack-based applications that produce freshness (expires, cache-control)
and/or validation (last-modified, etag) information:
- Standards-based (RFC 2616)
- Freshness/expiration based caching
- Validation (
if-modified-since/if-none-match) varysupportcache-controlpublic,private,max-age,s-maxage,must-revalidate,
andproxy-revalidate.- Portable: 100% Ruby / works with any Rack-enabled framework
- Disk, memcached, and heap memory storage backends
For more information about Rack::Cache features and usage, see:
https://rack.github.io/rack-cache/
Rack::Cache is not overly optimized for performance. The main goal of the
project is to provide a portable, easy-to-configure, and standards-based
caching solution for small to medium sized deployments. More sophisticated /
high-performance caching systems (e.g., Varnish, Squid, httpd/mod-cache) may be
more appropriate for large deployments with significant throughput requirements.
Installation
gem install rack-cache
Basic Usage
Rack::Cache is implemented as a piece of Rack middleware and can be used with
any Rack-based application. If your application includes a rackup (.ru) file
or uses Rack::Builder to construct the application pipeline, simply require
and use as follows:
require 'rack/cache'
use Rack::Cache,
metastore: 'file:/var/cache/rack/meta',
entitystore: 'file:/var/cache/rack/body',
verbose: true
run app
Assuming you've designed your backend application to take advantage of HTTP's
caching features, no further code or configuration is required for basic
caching.
Using with Rails
# config/application.rb
config.action_dispatch.rack_cache = true
# or
config.action_dispatch.rack_cache = {
verbose: true,
metastore: 'file:/var/cache/rack/meta',
entitystore: 'file:/var/cache/rack/body'
}
You should now see Rack::Cache listed in the middleware pipeline:
rake middleware
Using with Dalli
Dalli is a high performance memcached client for Ruby.
More information at: https://github.com/mperham/dalli
require 'dalli'
require 'rack/cache'
use Rack::Cache,
verbose: true,
metastore: "memcached://localhost:11211/meta",
entitystore: "memcached://localhost:11211/body"
run app
Noop entity store
Does not persist response bodies (no disk/memory used).
Responses from the cache will have an empty body.
Clients must ignore these empty cached response (check for x-rack-cache response header).
Atm cannot handle streamed responses, patch needed.
require 'rack/cache'
use Rack::Cache,
verbose: true,
metastore: <any backend>
entitystore: "noop:/"
run app
Ignoring tracking parameters in cache keys
It's fairly common to include tracking parameters which don't affect the content
of the page. Since Rack::Cache uses the full URL as part of the cache key, this
can cause unneeded churn in your cache. If you're using the default key class
Rack::Cache::Key, you can configure a proc to ignore certain keys/values like
so:
Rack::Cache::Key.query_string_ignore = proc { |k, v| k =~ /^(trk|utm)_/ }
Owner metadata
- Name: Official Rack repositories
- Login: rack
- Email:
- Kind: organization
- Description:
- Website: http://rack.github.com
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/42379?v=4
- Repositories: 10
- Last ynced at: 2024-03-25T19:32:49.958Z
- Profile URL: https://github.com/rack
GitHub Events
Total
- Watch event: 5
Last Year
- Watch event: 3
Committers metadata
Last synced: 3 days ago
Total Commits: 378
Total Committers: 53
Avg Commits per committer: 7.132
Development Distribution Score (DDS): 0.495
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Ryan Tomayko | r****o@g****m | 191 |
| Michael Grosser | m****l@g****t | 64 |
| Samuel Williams | s****s@o****z | 16 |
| amatriain | g****t@g****m | 12 |
| Daniel Mendler | m****d@s****e | 9 |
| Ryan McGeary | r****n@m****g | 8 |
| Denis Bakunovitch | b****h@g****m | 5 |
| Julien Letessier | j****r@g****m | 5 |
| Olle Jonsson | o****n@g****m | 5 |
| Pat Nakajima | p****a@g****m | 4 |
| Yohei Kitamura | y****a@m****m | 4 |
| James Ruston | j****0@g****m | 3 |
| Jordan Tepper | 1****t | 3 |
| Randall Reed, Jr | r****r@g****m | 3 |
| Travis Warlick | t****k@g****m | 2 |
| Santiago Pastorino | s****o@w****m | 2 |
| Kyle Drake | k****e@g****m | 2 |
| Andrew Bloomgarden | s****r@g****m | 2 |
| Robert Butler | r****t@m****m | 2 |
| Nick Howard | n****h@n****) | 2 |
| Dan Kubb | d****b@a****m | 2 |
| Adnan Ali | a****i@g****m | 1 |
| Alexander A. Portnov | a****x@s****) | 1 |
| Ben Crouse | b****e@w****m | 1 |
| Tom Scott | t****t@w****m | 1 |
| Rafael Lima | r****a@m****r | 1 |
| winton | m****l@w****s | 1 |
| ilyutov | i****v@g****m | 1 |
| artygus | h****o@e****t | 1 |
| Xavier Noria | f****n@h****m | 1 |
| and 23 more... | ||
Committer domains:
- zerista.com: 1
- newsline.se: 1
- expedia.com: 1
- joshpeek.com: 1
- redhat.com: 1
- karmi.cz: 1
- matthewkirk.com: 1
- atalanda.com: 1
- boonedocks.net: 1
- urlgonomics.com: 1
- cmpct.info: 1
- hashref.com: 1
- engineeriam.net: 1
- wintoni.us: 1
- myfreecomm.com.br: 1
- weblinc.com: 1
- workarea.com: 1
- simba.(none): 1
- autopilotmarketing.com: 1
- nickboxen.(none): 1
- mixbook.com: 1
- wyeworks.com: 1
- mdsol.com: 1
- mcgeary.org: 1
- slizer.hadiko.de: 1
- oriontransfer.co.nz: 1
- grosser.it: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 7
Total pull requests: 19
Average time to close issues: 5 months
Average time to close pull requests: about 2 months
Total issue authors: 7
Total pull request authors: 11
Average comments per issue: 2.57
Average comments per pull request: 1.21
Merged pull request: 16
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- night-jellyfish (1)
- soumyaray (1)
- eraffel-MDSol (1)
- ioquatix (1)
- evman182 (1)
- phil-janeapp (1)
- acronin-stash (1)
Top Pull Request Authors
- ioquatix (6)
- olleolleolle (3)
- HeroProtagonist (3)
- timdef (2)
- evman182 (2)
- Matt-Yorkley (2)
- cutalion (1)
- petergoldstein (1)
- thesamesam (1)
- monfresh (1)
- mjobin-mdsol (1)
Top Issue Labels
- bug (1)
Top Pull Request Labels
Package metadata
- Total packages: 4
-
Total downloads:
- rubygems: 121,896,534 total
- Total docker downloads: 1,639,458
- Total dependent packages: 93 (may contain duplicates)
- Total dependent repositories: 150,895 (may contain duplicates)
- Total versions: 98
- Total maintainers: 3
- Total advisories: 1
gem.coop: rack-cache
Rack::Cache is suitable as a quick drop-in component to enable HTTP caching for Rack-based applications that produce freshness (expires, cache-control) and/or validation (last-modified, etag) information.
- Homepage: https://github.com/rack/rack-cache
- Documentation: http://www.rubydoc.info/gems/rack-cache/
- Licenses: MIT
- Latest release: 1.17.0 (published almost 2 years ago)
- Last Synced: 2026-03-01T22:02:30.819Z (1 day ago)
- Versions: 36
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 60,952,270 Total
- Docker Downloads: 819,729
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Downloads: 0.444%
- Average: 0.477%
- Docker downloads count: 1.463%
- Maintainers (3)
rubygems.org: rack-cache
Rack::Cache is suitable as a quick drop-in component to enable HTTP caching for Rack-based applications that produce freshness (expires, cache-control) and/or validation (last-modified, etag) information.
- Homepage: https://github.com/rack/rack-cache
- Documentation: http://www.rubydoc.info/gems/rack-cache/
- Licenses: MIT
- Latest release: 1.17.0 (published almost 2 years ago)
- Last Synced: 2026-02-27T22:01:41.212Z (4 days ago)
- Versions: 36
- Dependent Packages: 93
- Dependent Repositories: 150,895
- Downloads: 60,944,264 Total
- Docker Downloads: 819,729
-
Rankings:
- Dependent repos count: 0.102%
- Dependent packages count: 0.335%
- Downloads: 0.364%
- Docker downloads count: 2.046%
- Average: 3.622%
- Forks count: 8.716%
- Stargazers count: 10.168%
- Maintainers (3)
- Advisories:
proxy.golang.org: github.com/rack/rack-cache
- Homepage:
- Documentation: https://pkg.go.dev/github.com/rack/rack-cache#section-documentation
- Licenses: other
- Latest release: v1.17.0 (published almost 2 years ago)
- Last Synced: 2026-02-27T22:01:42.203Z (4 days ago)
- Versions: 25
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Forks count: 6.637%
- Stargazers count: 7.428%
- Average: 8.611%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
debian-13: ruby-rack-cache
- Homepage: https://github.com/rack/rack-cache
- Documentation: https://packages.debian.org/trixie/ruby-rack-cache
- Licenses:
- Latest release: 1.17.0-1 (published 19 days ago)
- Last Synced: 2026-02-13T13:18:50.789Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- bump >= 0 development
- dalli >= 0 development
- hanna-nouveau >= 0 development
- maxitest >= 0 development
- memcached >= 0 development
- mocha >= 0 development
- rake >= 0 development
- rdiscount >= 0 development
- thin >= 0 development
- rack >= 0.4
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- JamesIves/github-pages-deploy-action v4.3.3 composite
- actions/checkout v3 composite
- ruby/setup-ruby v1 composite
- bake >= 0
- bake-gem >= 0
Score: 26.34122778258835